Skip to content
This repository was archived by the owner on Oct 3, 2021. It is now read-only.

Commit 4fc0a70

Browse files
author
Kaan Ozdokmeci
committed
initial implementation for randomsubset from multiple keys
1 parent 2868abe commit 4fc0a70

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/srandsubsetfrommulti.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
local main_key = KEYS[1]
2+
local from = tonumber(ARGV[1])
3+
local to = tonumber(ARGV[2])
4+
local amount = tonumber(ARGV[3])
5+
local final_set = {}
6+
7+
for counter = from, to do
8+
for k,v in pairs(redis.call('evalsha','bd8d94deaa1113ee0c1beae00bab6de0cc88be89',1,main_key .. counter,tostring(amount))) do
9+
final_set[#final_set+1] = v
10+
end
11+
end
12+
13+
return final_set

0 commit comments

Comments
 (0)