how can i count a zSet score by original API?
Comment From: sundb
Do you mean the total score?
Comment From: Snax1210
yes
Comment From: sundb
You can use the following lua code to get the sum of a zset's scores.
local ret = 0
local data = redis.call('zrange', KEYS[1], 0, -1, 'withscores')
for i=1, #data, 2 do
ret = ret + data[i+1]
end
return ret
Comment From: Snax1210
I know your means,but the original API can't support, isn't it?
Comment From: sundb
Yes, do you mean command? There is now no command to support this operation.
Comment From: Snax1210
i know,THX