新闻中心

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

时间:2010-12-5 17:23:32  作者:人工智能   来源:IT科技类资讯  查看:  评论:0
内容摘要:复制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.
copyright © 2025 powered by 编程之道  滇ICP备2023006006号-34sitemap