On Fri, Mar 23, 2012 at 9:36 AM, <email@example.com>
as you know I am looking for inmemory storage with iterators or range-functions.
One approach might be the Kyoto Cabinet, a "successor" of Tokyo Cabinet.
It already has a complete Lua-API.
At least for kyotocabinet-lua-1.24, it is incorrectly using Lua globals (rather than module-scoped variables) for its internal data structures, which may cause troubles in the context of ngx_lua because ngx_lua's global scope is per-request and will be destroyed before each request completes.
It is said to be threadsafe, but one has to open the database first.
My question to you is: How can I in ngx lua execute and keep certain Lua-Code,
e.g. opening the database once and all workers of nginx can access this open db-handle then?
Here is the Kyoto Cabinet: http://fallabs.com/kyotocabinet/
Maybe an interesting enhancement for ngx lua, too?
If this Lua binding is implemented properly then it can already be used in ngx_lua without modifying ngx_lua.
P.S. I've cc'd the openresty mailing group so that the whole openresty team (as well as other users) can see our discussion here.