membphis commented on code in PR #8113:
URL: https://github.com/apache/apisix/pull/8113#discussion_r998110267


##########
apisix/core/ai.lua:
##########
@@ -71,6 +97,26 @@ function  _M.routes_analyze(routes)
     else
         core.log.info("use ai plane to match route")
         router.match = ai_match
+
+        if get_cache_key_func_def_render == nil then
+            local template = require("resty.template")
+            get_cache_key_func_def_render = 
template.compile(get_cache_key_func_def)
+        end
+
+        local str = get_cache_key_func_def_render({route_flags = route_flags})

Review Comment:
   can we move this logic to one function?
   
   then we can check the return value, and do different thing



##########
apisix/core/ai.lua:
##########
@@ -71,6 +97,26 @@ function  _M.routes_analyze(routes)
     else
         core.log.info("use ai plane to match route")
         router.match = ai_match
+
+        if get_cache_key_func_def_render == nil then
+            local template = require("resty.template")

Review Comment:
   can we do this `template` at top level?



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