Redis data being deleted after some time on its own

28 views Asked by At

I have a problem with Redis db, it works not as intended. I have a Telegram bot that gets data from user and stores it in the Redis db. It writes and stores data correctly, but after some time data just gets deleted. Why is that? The bot and db run on a remote server and don't get rebooted. But maybe Redis does reboots automatically? I don't know. Note that I use Redis as primary database.

1

There are 1 answers

4
Gokulakrishna M On

Redis is not a permanent storage, data gets flushed when server gets restarted unexpectedly or a flush command is executed. So try using other databases for your exact need.

In Case if your db doesnt restarts, maybe you might have set expiry for Redis Keys.If no expiry is set, kindly check maxmemory-policy in redis.conf your keys get flushed when you run out of memory.