siaron opened a new issue #5223:
URL: https://github.com/apache/apisix/issues/5223


   ### Issue description
   
   ```
      local red = redis_new()
       local timeout = conf.redis_timeout or 1000    -- 1sec
       core.log.info("ttl key: ", key, " timeout: ", timeout)
   
       red:set_timeouts(timeout, timeout, timeout)
   
       local ok, err = red:connect(conf.redis_host, conf.redis_port or 6379)
       if not ok then
           return false, err
       end
   
       local count
       count, err = red:get_reused_times()
       if 0 == count then
           if conf.redis_password and conf.redis_password ~= '' then
               local ok, err = red:auth(conf.redis_password)
               if not ok then
                   return nil, err
               end
           end
   
           -- select db
           if conf.redis_database ~= 0 then
               local ok, err = red:select(conf.redis_database)
               if not ok then
                   return false, "failed to change redis db, err: " .. err
               end
           end
       elseif err then
           -- core.log.info(" err: ", err)
           return nil, err
       end
   ```
   每次都会重新创建一个redis 的connection吗? 还是
   ```
       local ok, err = red:connect(conf.redis_host, conf.redis_port or 6379)
   ```
   这一步后面后连接池?
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl 
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: 
depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks 
--version`):
   


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