Hello!
The implementation of lua-resty-lrucache can cache any data structure like Lua table or some userdata,
but it is per-worker, multiple workers cannot share the cache.
The ngx.shared.dict can be shared among multiple workers, but it store the serialized data like number, string,
so you have to serialize the complex structure by yourself before you store it to ngx.shared.dict.
Puts the cache to an external service like redis or memcached can share the data across a single machine,
but it costs some RTT to complete the communication.
I think you can combine these tools rather than use only one of them.
Some good libraries about this part:
- https://github.com/cloudflare/lua-resty-shcache
- https://github.com/thibaultcha/lua-resty-mlcache