DBAtlas · Database operations atlas

Set maxmemory and the policy

RedisMemory

Command

CONFIG SET maxmemory 4gb maxmemory-policy allkeys-lru

What it does

Sets the memory limit and the eviction policy applied when the limit is exceeded. Redis 7.0+ accepts multiple parameters in a single CONFIG SET; on older versions run two separate CONFIG SET commands.

When to use it

When you want to cap memory usage and define eviction behavior.

Caution

With the noeviction policy, writes fail once the limit is reached; a wrong limit can lead to data loss/downtime.

Open in DBAtlas →

Related