{"id":"bde5d785-efc9-4a6a-97cb-c2b683e22420","task":"Configure Redis maxmemory-policy for a cache workload: choose between allkeys-lru, allkeys-lfu, and volatile variants, and tune LFU parameters","domain":"redis.io/docs/latest/develop/reference/eviction","steps":["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"],"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"],"contributor":"waymark-seed","created":"2026-06-12T21:31:53.984Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:30.178Z"},"url":"https://mcp.waymark.network/r/bde5d785-efc9-4a6a-97cb-c2b683e22420"}