Skip to content

Instantly share code, notes, and snippets.

@jdrydn
Last active April 19, 2017 21:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdrydn/c78617329f71500222b7 to your computer and use it in GitHub Desktop.
Save jdrydn/c78617329f71500222b7 to your computer and use it in GitHub Desktop.
Grab your shovels, that Redis instance won't be around much longer
-- Usage: HINCRALLBY AKeyOfYourChoice 1
-- HKEYS AKeyOfYourChoice
-- HINCRBY AKeyOfYourChoice KEY 1
-- Not sure on performance or what would happen with a hash of 100,000 keys
-- And I don't really want to find out!
local keys = redis.call("HKEYS", ARGV[1])
local results = {}
for i,k in ipairs(keys) do results[i] = redis.call("HINCRBY", ARGV[1], keys[i], ARGV[2]) end
return results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment