lua-resty-lrucache icon indicating copy to clipboard operation
lua-resty-lrucache copied to clipboard

Runtime error: table index is nil

Open ktosikowski opened this issue 4 years ago • 0 comments

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 the error:

  access_by_lua_block {

    local lrucache = require "resty.lrucache"
    local cache, cache_init_err = lrucache.new(10)

    if not cache or cache_init_err then
        log(ERROR, "Failed to create cache. Reason: " .. (cache_init_err or "unknown"))
    else
        cache:set("dog", 32)
    end
  }

lua-resty-lrucache ver.: 0.08

ktosikowski avatar Jun 08 '20 14:06 ktosikowski