Skip to content

Instantly share code, notes, and snippets.

@srmklive
Created October 12, 2018 08:13
Show Gist options
  • Save srmklive/2ca197fd9829c5c57e3a3e957ce739b2 to your computer and use it in GitHub Desktop.
Save srmklive/2ca197fd9829c5c57e3a3e957ce739b2 to your computer and use it in GitHub Desktop.
Atomically delete keys matching a specific pattern in Redis
# Go to redis terminal using command 'redis-cli'. After redis terminal is opened, type in the following command to remove entries:
EVAL "local keys = redis.call('keys', ARGV[1]) \n for i=1,#keys,5000 do \n redis.call('del', unpack(keys, i, math.min(i+4999, #keys))) \n end \n return keys" 0 prefix:*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment