local redis = require "resty.redis" local red = redis:new() red:set_timeout() -- sec -- or connect to a unix domain socket file listened -- by a redis server: -- local ok, err = red:connect("unix:/path/to/redis.sock") local ok, err = r…
==========================example for lua json======================= local cjson = require("cjson") local str = '["a", "b", "c"]' local j = cjson.decode(str) for i,v in ipairs(j) do print(v) end str = '{"A&quo…
ngx_lua将lua嵌nginx,让nginx运行lua脚本.高并发,非堵塞过程中的各种请求. url要求nginxserver,然后lua查询redis,返回json数据. 一.安装lua-nginx-module 參见<LNMLGC>架构 二.安装redis2-nginx-module模块 get https://github.com/openresty/echo-nginx-module get https://github.com/openresty/redis2-nginx-mod…