'Is it recommended to put a max TTL in every key even if it has no TTL for server-side caching?

Redis server-assisted client side caching official page says:

Putting a max TTL in every key is a good idea, even if it had no TTL. This is a good protection against bugs or connection issues that would make the client having old data in the local copy.

...but Redis documentation does not say whether it is a good practice to always set at least a max TTL for server-side caching.


Is it a bad practice to do not set a TTL at all?

For example, I cache some data for a long time and I am fine to set expire=None for it because the data changes rarely.

At the same time, I am afraid that I will do some code changes and I will forget to clean up absolute key/value. As I understand, that absolute data may stay forever in Redis only wasting space.

Is it a good practice to always set at least a huge TTL (e.g. 1 year) to stay safe?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source