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

css - Text drops down with smaller window -

php - Boolean search on database with 5 million rows, very slow -

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