Created
September 19, 2012 13:48
-
-
Save dartov/3749780 to your computer and use it in GitHub Desktop.
Redis Lua "where" function
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 keys = redis.call('hgetall',KEYS[1]) | |
local i = ARGV[1] | |
local key | |
local value | |
for k,v in ipairs(keys) do | |
if k % 2 == 0 then | |
value = v | |
else | |
key = v | |
end | |
if value == i then | |
return key | |
end | |
-- redis.log(redis.LOG_WARNING, k,v) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment