Redis Displacement Policies
Redis Displacement Policies
The maxmemory-policy is an algorithm by which Redis frees memory when its actual utilization in the cluster reaches the maximum available memory (maxmemory).
The maxmemory value is 75% of RAM (the other 25% is reserved for service processes).
Selecting a preemptive policy can be done by cluster creation or modify in the created cluster.
List of policies
- volatile-lru — removes expired keys using the approximated LRU algorithm;
- allkeys-lru- removes any key using the approximated LRU algorithm;
- volatile-lfu — removes expired keys using the approximated LFU algorithm;
- allkeys-lfu — removes any key using the approximated LFU algorithm;
- volatile-random — removes a random key with expired validity;
- allkeys-rando — removes any random key;
- volatile-ttl — removes a key with a shorter lifetime (smaller TTL);
- noeviction — does not delete keys, just returns an error on write operations.
Change the displacement policy
When you change the policy, the key deletion rules change.
For your information
We recommend changing the policy only if you are sure what it will affect — there is a possibility of losing some data.
- В control panels go to Cloud platform → Databases.
- Open the cluster page → tab Settings.
- In the block Displacement policy click Modify and select a new algorithm.