We had a leak in code which resulted in few keys not getting deleted in redis elasticache. We noticed it only when the number became > 3 million. We have fixed code around it, however we need to fix the redis as well. Now we cant flush all as it will delete all the keys. We only want to delete keys, lets say older than 15 days. I found few commands online like however how can I iterate over 3 million records without getting the system stuck. Please help.
Thank you in advance.
object idletime
del record
2
Answers
Anyone looking for similar problem as mine, the below code worked for me. It's not very efficient but does the work for me.
You can configure the maxmemory and set an eviction policy which will delete the keys based on the policy once maxmemory is hit.
https://docs.aws.amazon.com/whitepapers/latest/database-caching-strategies-using-redis/evictions.html