Created
September 25, 2011 06:22
-
-
Save JeromeParadis/1240295 to your computer and use it in GitHub Desktop.
Redis: How delete keys matching a pattern?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis-cli KEYS "prefix:*" | xargs redis-cli DEL |
that is, if your database is number 1 and your pattern is FOO* :)
I just published a command line interface utility to npm and github that allows you to delete keys that match a given pattern (even *) from a Redis database.
You can find the utility here:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
redis-cli -n 1 keys FOO* |sed "s/"^.*")//g"|xargs redis-cli -n 1 del