Created
July 11, 2019 06:05
-
-
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
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
| 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