hello. i want some help with my lua scritps
local cursor = '0'
local pattern = ARGV[1] .. ':*'
repeat
local result = redis.call('SCAN', cursor, 'MATCH', pattern)
cursor = result[1]
local batchKeys = result[2]
for _, key in ipairs(batchKeys) do
redis.call('DEL', key)
end
until cursor == '0'
return true
I get “script tried accessing undeclared key” when using key
inside for
clause. should i use allow-undeclared-keys
flag in this case?