Skip to content

Instantly share code, notes, and snippets.

View selmi-karim's full-sized avatar
🐢
I may be slow to respond.

karim selmi-karim

🐢
I may be slow to respond.
  • OneFootball
  • Berlin
  • 00:43 (UTC +01:00)
View GitHub Profile
@selmi-karim
selmi-karim / redis.sh
Created June 4, 2020 17:06
script to get, update and extend the TTL value of all the redis keys
## 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 {}