We have several SETs containing KEYS in the form of:
x:123456789:t
(t values are stringified JSON texts like {"k":"v", "k":"v", "k":"v"…})
We intersect 3+ of these SETs with
local c1 = redis.call('SINTERSTORE', sTemp, unpack(KEYS))
Now we'd like to get the t text-values associated with the KEYS in the resulting SET setTemp with
SORT sTemp BY NOSORT GET *:t
which gives us something like this via redis-cli
{"k":"v", "k":"v", "k":"v"…}
{"k":"v", "k":"v", "k":"v"…}
{"k":"v", "k":"v", "k":"v"…}…
Now how does one represent SORT sTemp BY NOSORT GET *:t in lua?
These random tries give the obvious errors:
c1 = redis.call('SINTERSTORE', sTemp, unpack(KEYS))
1. local c2 = redis.call('SORT sTemp by nosort get *:t') => sTemp is not a local variable
2. local sTemp
local c2 = redis.call('SORT sTemp by nosort get *:t') => [Error: Unknown Redis command called from Lua script]
3. local c2 = redis.call('SORT', sTemp, 'by nosort get *:t') => [Error: Lua redis() command arguments must be strings or integers]
I don't know if looping through sTemp set with ID KEYS and doing a GET on each would be less performant than SORT in one operation, but I'd like to know if it can be done in lua.
Thanks.