Koskamo

maxmemory limits and eviction policies

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

The maxmemory configuration directive sets the memory limit for cache data — maxmemory 100mb in redis.conf, or CONFIG SET maxmemory 100mb at runtime — and zero means no limit, the default on 64-bit systems, while 32-bit systems use an implicit 3GB limit. When a new command would push usage past the limit, Redis evicts keys under the maxmemory-policy directive until memory use drops back below it. The noeviction policy returns an error on commands that cache new data while reads still work, and with replication this applies only to the primary. The allkeys-lru, allkeys-lrm, allkeys-lfu, and allkeys-random policies evict across all keys, while volatile-lru, volatile-lrm, volatile-lfu, volatile-random, and volatile-ttl evict only keys with an expiration — volatile-ttl picking the shortest remaining TTL — and the volatile policies behave like noeviction when no keys have an expiration. Rule of thumb: use allkeys-lru when a subset of elements is accessed far more often than the rest (a common Pareto case, and a good default), allkeys-lrm for read-heavy workloads, and allkeys-random when access is roughly uniform; the INFO command's runtime information helps check or improve the choice. Scope: Redis. Reviewed October 4, 2026.

Source and provenance

Original source
redis.io
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.