Skip to content

Instantly share code, notes, and snippets.

@bamthomas
Created January 18, 2020 10:35
Show Gist options
  • Save bamthomas/17c3e3086620b7ef58d10d7bf8d64f8d to your computer and use it in GitHub Desktop.
Save bamthomas/17c3e3086620b7ef58d10d7bf8d64f8d to your computer and use it in GitHub Desktop.
redis CLI : transform a set into a map
EVAL "local vals = redis.call('SMEMBERS', KEYS[1]); local len = redis.call('SCARD', KEYS[1]); for k, v in pairs(vals) do redis.call('HSET', KEYS[2], v, '0'); end; return len;" 2 setkey mapkey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment