javaredisjedis

Redis keys are getting deleted automatically


We are using redis as caching. There were cases when some of the keys were getting deleted and we couldn't find the reason. I put redis keyspace/keyevent for CONFIG SET notify-keyspace-events KEgxe on this notification I am putting logs. But neither I can find in my core-logs nor in this redis-logs for some keys. They have some data in RDBMS, so we are sure that those keys must have come into Redis. We are very much into lost state, on what basis should we debug this.

Redis info says it has ~100mb in usage, which looks ok to me. How to persist data and keys.


Solution

  • 2 possible reasons:

    1. the client failed to write to Redis
    2. some client deletes these missing keys

    You can try to subscribe everything about key changes: CONFIG SET notify-keyspace-events AKE, and log these changes into logs to figure out the problem.