Redis: How to delete all keys older than 3 months -
i want flush out keys older 3 months. these keys not set expire date.
or if not possible, can delete maybe oldest 1000 keys?
are now using expire? if so, loop through keys if no ttl set add one.
python example:
for key in redis.keys('*'): if redis.ttl(key) == -1: redis.expire(key, 60 * 60 * 24 * 7) # clear them out in week
Comments
Post a Comment