redis-cli CONFIG SET maxmemory-policy allkeys-lru

Category: Databases & SQL

redis-cli CONFIG SET maxmemory-policy allkeys-lru

Change the eviction policy at runtime

Sets which keys Redis evicts when maxmemory is reached; allkeys-lru evicts least-recently-used keys from any database. The change is runtime-only until CONFIG REWRITE persists it. Wrong policies can evict important keys, so test first.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.