根据URI参数后去信息类型和信息ID,通过lua client for memcached插入memcached
复制代码 代码如下:
require('Memcached') local args = ngx.req.get_uri_args()
if (ngx.var.remote_addr == '192.168.1.5') then local key = args['k'] local class = args['c'] local key = class..':'..key
local memcache = Memcached.Connect('127.0.0.1', 11212) if (memcache:add(key,1)) then memcache:get(key) else memcache:incr(key); ngx.print(memcache:get(key)) end else ngx.exit(404) end