You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/10/22 02:23:48 UTC
[GitHub] [apisix-go-plugin-runner] zdzh commented on issue #43: bug: WARN server/server.go:59 key not found
zdzh commented on issue #43:
URL: https://github.com/apache/apisix-go-plugin-runner/issues/43#issuecomment-949234173
lrucache should be set `invalid_stale = true`?
```lua
local events_list
local lrucache = core.lrucache.new({
type = "plugin",
ttl = helper.get_conf_token_cache_time(),
})
```
```lua
local function new_lru_fun(opts)
...
local item_release = opts and opts.release
local invalid_stale = opts and opts.invalid_stale -- false
local serial_creating = opts and opts.serial_creating
local lru_obj = lru_new(item_count)
return function (key, version, create_obj_fun, ...)
if not serial_creating or not can_yield_phases[get_phase()] then
local cache_obj = fetch_valid_cache(lru_obj, invalid_stale,
item_ttl, item_release, key, version)
if cache_obj then
return cache_obj.val
end
.....
```
```lua
local function fetch_valid_cache(lru_obj, invalid_stale, item_ttl,
item_release, key, version)
local obj, stale_obj = lru_obj:get(key)
if obj and obj.ver == version then
return obj
end
-- get a expired key in lrucachd that could not find in go runner
if not invalid_stale and stale_obj and stale_obj.ver == version then
lru_obj:set(key, stale_obj, item_ttl)
return stale_obj
end
if item_release and obj then
item_release(obj.val)
end
return nil
end
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org