mhgetthread.lua 869 B

123456789101112131415161718192021
  1. local result={}
  2. result.items={}
  3. result.loseItems={}
  4. local k1=KEYS[1]--未格式化key
  5. local k2=KEYS[2]--过期时间
  6. local lose={}
  7. for i = 1, #ARGV do
  8. local k=string.format(k1,ARGV[i])
  9. local v1=redis.call('expire',k,k2)
  10. if v1==0 then
  11. table.insert(result.items,{})
  12. lose[ARGV[i]]=i-1;
  13. else
  14. local info=hgetall(k)
  15. table.insert(result.items,info)
  16. -- local info=redis.call('hmget',k,'tid','pid','uid','nickname','face','timeline','replies','liketimes','imgext','post','closed','status','digest')
  17. -- table.insert(result.items,{['tid']=info[1],['pid']=info[2],['uid']=info[3],['nickname']=info[4],['face']=info[5],['timeline']=info[6],['replies']=info[7],['liketimes']=info[8],['imgext']=info[9],['post']=info[10],['closed']=info[11],['status']=info[12],['digest']=info[13]})
  18. end
  19. end
  20. result.loseItems=lose
  21. return cjson.encode(result)