Hi there, i am new to redis and facing the issue with keys which are getting removed automatically after some time. I thought i am removing those from my .net core application so i tried creating test key from the console directly and waited for some time and after 20/30 minutes the key wasn’t there. Note that I did not set TTL while creating key. Please help me out here with this situation why exactly the keys are getting removed automatically
Is it possible you’re running out of space and keys are getting evicted?
@jgaskins Thanks for the reply though there are only 5/6 keys I can see. How many keys can Redis hold exactly? I don’t think Redis is running out of space and keys are getting evicted.
Redis can hold billions of keys, so I agree that’s probably not the case unless those keys have absolutely enormous values. Is it possible your Redis provider sets a default expiration? For example, if you run SET foo bar
and then TTL foo
, does it return -1
(no expiration on the specified key) or some number of seconds? If it returns -2
, it means the key was already deleted.
@jgaskins I tried this way and I was able to see -1 for newly created key still that key is getting removed automatically after sometime. Not sure what to do exactly.