Created
October 5, 2018 12:07
-
-
Save OleksandrKucherenko/fdd8c555dfb3225910ceee037749bd61 to your computer and use it in GitHub Desktop.
Redis LUA Script. Create from KEYS a list/array/queue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local list = KEYS[1] | |
local search = KEYS[2] | |
local instances = redis.call('KEYS', search) | |
if nil == instances then return nil end | |
redis.call('DEL', list) | |
local counter = 0 | |
for i,instance in ipairs(instances) do | |
redis.call('LPUSH', list, instance) | |
counter = counter + 1 | |
end | |
return counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or from Javascript: