Hello,
I am trying to design system where I am processing certain keys. These keys are further utilized in the same application to decrypt the data. These keys values won't update.
The existing system was storing all keys in-memory (which is not efficient) as keys will only increase in future, currently ofcourse leading to a high memory consumption.
I moved the logic of storing keys and getting it to Redis without any TTL set.
For now, memory consumption in Redis is looking okay. I can also set TTL to a higher number, but
trying to understand if its better to use Redis only as cache and store the actual keys to Postgres.
This could potentially slow the process but curious to understand if its okay to continue using Redis or replace with Postgres DB
Using Redis exclusively for storing an ever-increasing number of keys without TTL is not sustainable in the long term due to memory limitations and cost. By leveraging Postgres for persistent storage and Redis as a cache, you can achieve a balance between performance and scalability. This hybrid approach is a common best practice and should serve your application well as it grows.
Thank you so much