Updated on 2022-02-21 GMT+08:00

What Is the Default Data Eviction Policy?

Data is evicted from cache based on a user-defined space limit in order to make space for new data. In the current versions of DCS, you can select an eviction policy.

noeviction is the default eviction policy for single-node and master/standby DCS Redis instances. You can change the eviction policy by configuring the instance parameters on the DCS console.

volatile-lru is the default eviction policy for cluster DCS Redis instances. To change the eviction policy for cluster instances, contact the administrator.

When maxmemory is reached, you can select one of the following six eviction policies:

  • noeviction: When the memory limit is reached, DCS instances return errors to clients and no longer process write requests and other requests that could result in more memory to be used. However, DEL and a few more exception requests can continue to be processed.
  • allkeys-lru: DCS instances try to evict the least recently used keys first, in order to make space for new data.
  • volatile-lru: DCS instances try to evict the least recently used keys with an expire set first, in order to make space for new data.
  • allkeys-random: DCS instances recycle random keys so that new data can be stored.
  • volatile-random: DCS instances evict random keys with an expire set, in order to make space for new data.
  • volatile-ttl: DCS instances evict keys with an expire set, and try to evict keys with a shorter time to live (TTL) first, in order to make space for new data.

    If no key can be recycled, volatile-lru, volatile-random, and volatile-ttl are the same as noeviction. For details, see the description of noeviction.