How do you configure deletion policies in Redis?
In Redis, deletion policies can be configured through parameters, and there are several specific deletion policies available.
- no removal from property
- unpredictable least recently used
- unpredictable time to live
- unpredictable-random
- least recently used keys
- randomly generated keys
- fickle-least frequently used
- Least frequently used of all keys
The default eviction policy is noeviction, and it can be configured in the Redis configuration file redis.conf by setting the maxmemory-policy parameter. For example, the configuration set to volatile-lru is as follows:
maxmemory-policy volatile-lru