spacewander commented on a change in pull request #2575:
URL: https://github.com/apache/apisix/pull/2575#discussion_r521784444



##########
File path: apisix/core/lrucache.lua
##########
@@ -125,42 +139,37 @@ end
 global_lru_fun = new_lru_fun()
 
 
-local function _plugin(plugin_name, key, version, create_obj_fun, ...)
-    local lru_global = global_lru_fun("/plugin/" .. plugin_name, nil,
-                                      lru_new, PLUGIN_ITEMS_COUNT)
-
-    local obj, stale_obj = lru_global:get(key)
-    if obj and obj.ver == version then
-        return obj.val
-    end
-
-    if stale_obj and stale_obj.ver == version then
-        lru_global:set(key, stale_obj, PLUGIN_TTL)
-        return stale_obj

Review comment:
       Here we need to return `stale_obj.val` instead. Otherwise, the returned 
value will be:
   ```
   ver = xxx,
   val = actual_cache_obj,
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to