Skip to content

Instantly share code, notes, and snippets.

View kchristidis's full-sized avatar
:bowtie:

Kostas Christidis kchristidis

:bowtie:
View GitHub Profile
@kchristidis
kchristidis / redis-aggregate.lua
Created October 9, 2020 05:53 — forked from lloydzhou/redis-aggregate.lua
Aggregate values in a redis sorted set. Returns {count, sum, min, max}
local count = 0
local sum = 0
local min = 0
local max = 0
local cursor = "0"
local result = nil
local data = nil
repeat
result = redis.call("zscan", KEYS[1], cursor, "count", 100)