In Redis, using allkeys-lru deletes the key no matter if it's an expire-set key or not.
Using TTL, setting an expiration for the key, uses memory.
Quoting from Redis.io:
It is also worth noting that setting an expire to a key costs memory, so using a policy like allkeys-lru is more memory efficient since there is no need to set an expire for the key to be evicted under memory pressure.
- Is it really more efficient overall to NOT put a
TTLon the key and letallkeys-lrupolicy handle it? - Isn't there any tradeoffs in this situation? For example, does the
allkeys-lrublock the write action until it completes the expiration? That would make me use the TTL if this expiration is going to take long durations.
I would love to discuss about this. Thanks for everybody's input!