| myst |
|
|---|
You can change the Redis maxmemory-policy with hypernode-systemctl settings redis_eviction_policy. This policy determines which keys Redis can evict when memory is full.
The following values are supported for redis_eviction_policy:
noevictionallkeys-lruallkeys-lfuallkeys-randomvolatile-lruvolatile-lfuvolatile-ttlvolatile-random
By default, Redis on Hypernode uses the `volatile-lru` eviction policy.
To view the current Redis eviction policy:
hypernode-systemctl settings redis_eviction_policyUse the following command to change the Redis eviction policy:
hypernode-systemctl settings redis_eviction_policy <policy>For example:
hypernode-systemctl settings redis_eviction_policy allkeys-lruRedis will not evict any keys when memory is full. New write operations that require memory will fail.
Redis can evict any key and removes the least recently used keys first.
Redis can evict any key and removes the least frequently used keys first.
Redis can evict any key and removes keys at random.
Redis only evicts keys with an expiration time and removes the least recently used keys first.
This is the default policy on Hypernode.
Redis only evicts keys with an expiration time and removes the least frequently used keys first.
Redis only evicts keys with an expiration time and prefers keys that will expire soonest.
Redis only evicts keys with an expiration time and removes those keys at random.
- Eviction only takes place when Redis reaches its memory limit.
- Policies starting with
allkeys-can evict any key, including keys without a TTL. - Even with an
allkeys-policy, Redis can still run into memory pressure if keys cannot be evicted fast enough to keep up with writes. - Setting a TTL on cache keys is still recommended, even when using an
allkeys-policy. - Policies starting with
volatile-only apply to keys with a TTL. - If not enough keys have a TTL, Redis may not be able to evict enough data with a
volatile-policy, and write operations may fail. - Changing the policy does not remove existing keys immediately.