lua-resty-lrucache
lua-resty-lrucache copied to clipboard
Lua-land LRU Cache based on LuaJIT FFI
1. add peek() and delete_oldest() api for lrucache 2. implement arccache for both lua and pureffi 3. improve expire logic in lrucache.set() 4. add tests for both lua arccache and...
Does lua-resty-lrucache's get/set method are atomic operations? In same worker process, Does this happen: lrucache key **X** store a string, two request get and set lrucache sametime, get not complete...
`lrucache:set(key, value, ttl, flags)` `os.execute("sleep " .. tonumber(ttl+2))` `local data, stale_data, flags = lrucache:get(key)` data is not nil lruchache' get method `if node.expire >= 0 and node.expire < ngx_now() then`...
What about implement a `resize` api to support adjust the size of lru dynamically? like ``` local c = lrucache.new(100) c:resize(50) ```
add evict call back func in lrucache, when obj been evict, call this func
The following error is visible in nginx logs when trying to set value in lrucache: *10 lua entry thread aborted: runtime error: /usr/share/lua/5.1/resty/lrucache.lua:223: table index is nil Code leading to...
lru.get() returns the remaining ttl on success. Comparable to ngx.shared.DICT.ttl altough integrated directly into the get function. Could change it to a standalone function if that's preferable.
Incr method
Incrementing by value, defaults to 1. Happy to do the documentation if you do the tests :)
stress test by comparing lru-$ and lruffi-$ side-by-side. Keys are generated by randomly grab words from big plain-text download from Internet.