Created
June 4, 2020 17:06
-
-
Save selmi-karim/18acc6f8ca4c89dcad9f0f46d847b219 to your computer and use it in GitHub Desktop.
script to get, update and extend the TTL value of all the redis keys
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
## extend all the redis TTL keys | |
redis-cli keys '*' | xargs -n1 -I {} /bin/bash -c 'redis-cli expire {} $(redis-cli ttl {} | xargs -I{} echo {} + EXTEND_VALUE | bc)' | |
## update all the redis keys with new ttl value | |
redis-cli KEYS '*' | xargs -I{} redis-cli EXPIRE {} EXPIRE_VALUE | |
## get all the redis TTL keys | |
redis-cli KEYS '*' | xargs -I{} redis-cli TTL {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment