如何在Go语言中使用Redis连接池

  发布时间:2025-11-04 19:01:02   作者:玩站小弟   我要评论
复制server{ location/pool{ content_by_lua_block{ localredis=require"r 。
如何在Go语言中使用Redis连接池
复制server {      location /pool {          content_by_lua_block {              local redis = require "resty.redis"             local red = redis:new()              local ok,语言中 err = red:connect("127.0.0.1", 6379)              if not ok then                  ngx.say("failed to connect: ", err)                  return             end              ok, err = red:set("hello", "world")              if not ok then                  return             end              red:set_keepalive(10000, 100)          }      }  }  1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.
  • Tag:

相关文章

最新评论