你的意思是类似redis hmset 命令吗?暂时还没有个这个命令
在 2014年9月4日星期四UTC+8上午10时43分21秒,Leo Liu写道:
hi all
需要用ngx_shared_dict对用户做一个计数。在5s->10次、20s->20次、100s->40次的情况下触发一些动作。
local count = shared_dict:get(key)
if not count then
count = 0
shared_dict:set(key, count, conf["period"])
end
count = count + 1
if count >= conf["threshold"] then
shared_dict:set(key, count, conf["suspect_timeout"])
return true, "over threshold"
end
shared_dict:incr(key, 1)
现在ngx_shared_dict只能做到单key,value,expire。是否只能通过创建多个shared dict,存储多份来实现呢?