monkeyDluffy6017 commented on code in PR #10138:
URL: https://github.com/apache/apisix/pull/10138#discussion_r1322781118


##########
apisix/plugins/proxy-cache/init.lua:
##########
@@ -140,6 +141,12 @@ function _M.check_schema(conf)
         end
     end
 
+    -- For memory based cache, the default cache_zone cannot be used.
+    -- cache_zone will also be set as default value in case when passed empty.
+    if conf.cache_strategy == STRATEGY_MEMORY and conf.cache_zone == 
DEFAULT_CACHE_ZONE then

Review Comment:
   It's not very reliable to judge by cache zone name, i think you could 
modified like this:
   ```
   if local_conf.apisix.proxy_cache then
       for _, cache in ipairs(local_conf.apisix.proxy_cache.zones) do
           if cache.name == conf.cache_zone then
               if conf.cache_strategy == STRATEGY_MEMORY and not 
cache.disk_path then
                   found = true
                   break
               elseif conf.cache_strategy == STRATEGY_DISK and cache.disk_path 
then
                   found = true
                   break
               end
           end
       end
       if found == false then
           return false, "cache_zone " .. conf.cache_zone .. " not found"
       end
   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: [email protected]

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

Reply via email to