Skip to content

Instantly share code, notes, and snippets.

@torao
Created November 16, 2018 04:48
Show Gist options
  • Save torao/99bef9042babc4fd95f7043cdbeb1278 to your computer and use it in GitHub Desktop.
Save torao/99bef9042babc4fd95f7043cdbeb1278 to your computer and use it in GitHub Desktop.
local hmgetall = function(...)
if next(arg) == nil then return [] end
local result = []
for j, key in ipairs(arg) do
local bulk = redis.call('HGETALL', key)
local hash = {}
local nextfield
for i, v in ipairs(bulk) do
if i % 2 == 1 then
nextkey = v
else
hash[nextkey] = v
end
end
result[j] = hash
end
return result
end
return hmgetall(KEYS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment