Last active
October 16, 2017 09:20
-
-
Save inakivb/b3782b38a02b7bc8b8f78b2e0e7f4dd2 to your computer and use it in GitHub Desktop.
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
A COLLECTION OF REDIS-CLI COMMANDS | |
PRODUCTION SAFE COMMANDS | |
Key pattern size sum | |
redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## --scan --pattern "*##PATTERN##*" | xargs -L 1 redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## --raw STRLEN | awk '{s+=$1} END {print s}' | |
Delete key pattern | |
redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## --scan --pattern "*##PATTERN##*" | xargs -L 10 redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## DEL | |
Delete big id-based HASH | |
for((i=1;i<=##MAX_ID##;i+=1)); do echo "$i"; done|xargs -L 10 redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## HDEL ##HASH_NAME## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment