Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local result = redis.call('zrange', KEYS[1], 0, -1, 'withscores')
- local count = 0
- local sum = 0
- local min = 0
- local max = 0
- for i=1, #result, 2 do
- local score = result[i + 1]
- count = count + 1
- sum = sum + score
- if i == 1 then
- min = score
- max = score
- else
- min = math.min(min, score)
- max = math.max(max, score)
- end
- end
- return {
- count, sum, min, max
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement