`
李俊良
  • 浏览: 141628 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

redis中统计sorted set的score的总和的lua脚本

 
阅读更多
eval "local res = 0;local totalCards;local i =0; totalCards = redis.call('zrangebyscore','inTimeCost','-inf','+inf','withscores');for i,v in ipairs(totalCards) do if i%2 == 0 then res = res + v; end; end;return res;" 0

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics