Created
March 15, 2012 20:47
-
-
Save gr2m/2046802 to your computer and use it in GitHub Desktop.
remove redis keys based on their expiration time
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
# remove all keys that will expire in less than 1 hour | |
redis-cli keys "*" | while read LINE ; do TTL=`redis-cli ttl $LINE`; if [ $TTL -le 3600 ]; then echo "Del $LINE"; RES=`redis-cli del $LINE`; fi; done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment