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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -