Welcome! Log In Create A New Profile

Advanced

Re: ngx.shared.DICT serialize / deserialize

Yichun Zhang (agentzh)
November 11, 2017 04:32PM
Hello!

On Thu, Nov 9, 2017 at 12:19 PM, Joel Parker wrote:
> I am trying to load a table from disk (deserialize) into memory and then
> add, change, remove the values in the table then write it periodically back
> to disk (serialize). I looked at the documentation for the ngx.shared.DICT
> (https://github.com/openresty/lua-nginx-module#ngxshareddict) and it seems
> like it would fit my needs but I do not see anywhere in the documentation
> how to load the table initially from disk and modify then write back to
> disk. Could someone provide a basic example of how I might accomplish this ?
>

You need to do serialization and persistence support yourself (like
using lua-cjson/lua-msgpack for serialization and the standard Lua io
module for file reads/writes). These are not built into the shdict API
directly. BTW, better post such questions to the openresty-en mailing
list:

https://openresty.org/en/community.html

Best regards,
Yichun
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

ngx.shared.DICT serialize / deserialize

Joel Parker November 09, 2017 03:20PM

Re: ngx.shared.DICT serialize / deserialize

Yichun Zhang (agentzh) November 11, 2017 04:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 309
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready