Skip to content

Instantly share code, notes, and snippets.

@anushshukla
Created July 11, 2019 06:05
Show Gist options
  • Select an option

  • Save anushshukla/7ceace31deff34802206c55bc9bf7c6b to your computer and use it in GitHub Desktop.

Select an option

Save anushshukla/7ceace31deff34802206c55bc9bf7c6b to your computer and use it in GitHub Desktop.
Pyhton Script to update the expire time of the first 10 Redis key
import redis
r = redis.Redis(host='127.0.0.1', port=6379, db=0)
i = 0
for key in r.scan_iter("*",3):
# delete the key
print(key)
r.expire(key,21600)
i +=1
if i > 10:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment