Skip to content

Instantly share code, notes, and snippets.

@dj1020
Forked from mattweyant/redis-delallbykey
Created March 25, 2025 02:35
Show Gist options
  • Save dj1020/69567897f3c086272763a94519199f68 to your computer and use it in GitHub Desktop.
Save dj1020/69567897f3c086272763a94519199f68 to your computer and use it in GitHub Desktop.
Delete all keys from Redis matching a regular expression
# All credit: http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-with-redis
redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL
@dj1020
Copy link
Author

dj1020 commented Mar 25, 2025

https://gist.github.com/mattweyant/2870203?permalink_comment_id=2174538#gistcomment-2174538

$ 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