Redis cache getting cleared automatically

100 views Asked by At

We have implemented redis cache in our application. We could see the cache is getting cleared every morning. We havent configured any maxmemory or TTL in redis config. And also we have checked in our codebase we are not doing any flush activity anywhere. Totally clueless on how it is happening. Can someone help?

I have tried real time monitoring and noticed it was getting cleared in a particular time daily.

1

There are 1 answers

0
Lajos Arpad On

You will need to check your cron jobs. Maybe some cron job flushes everything from Redis at that particular time. Also, look into Redis expire on this page:

https://redis.io/commands/expire/

Syntax:

EXPIRE key seconds [NX | XX | GT | LT]

So, you may have this command being executed for your keys and set to expire at a certain time, computed the difference between that and the current moment and using the result as the seconds parameter.

Look into FLUSHALL as well: https://redis.io/commands/flushall/

FLUSHALL [ASYNC | SYNC]

Something is removing your keys. Either all of them were set to expire at the same time, or flushall is being called or something like that.