Menu

Redis OOM command not allowed: Set maxmemory-policy
📰

Redis OOM command not allowed: Set maxmemory-policy

DEV Community: redis·Ace Meridian·4 days ago
#yV0vxDPP
#devtoredis#devto#dev#redis#cache
Reading 0:00
15s threshold

If Redis is only a cache, run redis-cli CONFIG SET maxmemory-policy allkeys-lru and put the same setting in redis.conf (or your managed service's parameter group): writes go through again, because Redis now evicts least recently used keys instead of refusing new ones. If the instance also holds queues, sessions or locks, keep volatile-lru and write every cache key with a TTL ( SET key value EX 3600 ), because the volatile policies can only evict keys that have one.

This story was written with the assistance of an AI writing program. I reproduced the error on Redis 8.10.2 with redis-py 8.1.0 and Python 3.14.4, with maxmemory at 20 MB and 1 KiB values so the instance fills in seconds. Every number below comes from those runs.

What the Error Blocks, and What It Doesn't

Under the default policy, noeviction , the 15,201st SET failed. redis-py raised redis.exceptions.OutOfMemoryError: command not allowed when used memory > 'maxmemory'. ; redis-cli prints the same text after OOM .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.