Set a maxmemory limit to cap Redis memory consumption: redis-cli CONFIG SET maxmemory 2gb
For a pure cache (all keys are ephemeral) use allkeys-lru or allkeys-lfu: CONFIG SET maxmemory-policy allkeys-lfu — allkeys-lfu evicts the least frequently accessed keys, better for skewed access patterns
For mixed workloads where some keys must never be evicted (no expiry set), use volatile-lru or volatile-lfu which only evict keys with an TTL set
Tune LFU parameters for allkeys-lfu or volatile-lfu: CONFIG SET lfu-log-factor 10 (higher value = slower frequency counter increment, more granular differentiation) and CONFIG SET lfu-decay-time 1 (minutes before frequency counter decays)
Verify the current policy: CONFIG GET maxmemory-policy
Monitor eviction metrics: INFO stats | grep evicted_keys — a rising evicted_keys count confirms eviction is active; cross-check with keyspace hit/miss ratio via INFO keyspace
Known gotchas
allkeys-lru and allkeys-lfu use a probabilistic approximation, not exact LRU/LFU — Redis samples a configurable number of keys (maxmemory-samples, default 5) and evicts the best candidate among the sample; increase maxmemory-samples for better accuracy at higher CPU cost
Setting maxmemory-policy noeviction (the default) causes Redis to return OOM errors on write commands when memory is full — this is appropriate for persistence use cases but catastrophic for cache-only deployments under memory pressure
volatile-lru/volatile-lfu evict nothing if no keys have a TTL set; the instance will return OOM errors as if noeviction were set — ensure cache keys always have an expiry when using volatile policies
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp