Skip to content

Instantly share code, notes, and snippets.

@azureru
Last active February 9, 2021 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azureru/05e1578122e1cde384b8b27ab30d86b1 to your computer and use it in GitHub Desktop.
Save azureru/05e1578122e1cde384b8b27ab30d86b1 to your computer and use it in GitHub Desktop.
Eval Redis Cheatsheets

Delete Keys By Pattern

If for example your redis instance disable flushall or flushdb

# using LUA in redis-cli
eval "for _,k in ipairs(redis.call('keys','flag:*')) do redis.call('del',k) end" 0
# using shell <-- this one is better since it use scan
redis-cli --scan --pattern "*:foo:bar:*" | xargs -L 100 redis-cli DEL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment