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

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

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -