Created
December 3, 2014 04:45
-
-
Save ckng/6a467d54ef5a80887ee0 to your computer and use it in GitHub Desktop.
Redis: Bulk delete key
This file contains hidden or 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
#!/bin/bash | |
if [[ -z $1 ]] | |
then | |
echo "Usage: $0 <key>, key: key to delete, e.g. \"mykey*\"" | |
exit 1; | |
fi | |
# does not check if key exists | |
# if key does not exists, you likely get "ERR wrong number of arguments for 'del' command" | |
echo "Redis: bulk removing key \"$1\"" | |
/usr/bin/redis-cli KEYS "$1" | xargs /usr/bin/redis-cli DEL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment