Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
将记录的谷歌搜索词存入redis中
red = redis:new()
red:set_timeout(1000)
local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.log(ngx.WARN, "failed to connect: ", err)
return
end
ok, err = red:select(2)
if not ok then
ngx.log("failed to select: ", err)
return
end
local args = ngx.req.get_uri_args()
if args["q"] then
local key = getClientIp()
local data, err = red:sadd(key, args["q"])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.