Created
July 13, 2018 08:34
-
-
Save bibigon812/3ed16d4f19f0334d7b4754939e1489e4 to your computer and use it in GitHub Desktop.
Drop all keys without a TTL in Redis
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
#!/bin/sh | |
redis-cli keys "*" | while read LINE ; do | |
TTL=`redis-cli ttl "$LINE"` | |
if [ $TTL -eq -1 ]; then | |
echo "$LINE" | redis-cli del | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment