Cache eviction
Deciding what to throw out when the cache is full — the whole difference between a cache that helps and one that just consumes memory.
A cache with unlimited room needs no policy. Real caches are small relative to the data, so every new entry demands that an old one be sacrificed. LRU is the common choice, discarding the least recently used entry; LFU counts uses instead and keeps what is frequently requested; FIFO drops the oldest regardless of popularity; random evicts arbitrarily and performs surprisingly close to LRU for a fraction of the bookkeeping.
Eviction is not expiry. TTL removes entries because they have gone stale, eviction because space ran out — Redis keeps them as separate settings and can be configured to refuse writes when memory fills rather than discard anything. The pathological case is cache thrashing: when the working set is just larger than the cache, every entry is evicted shortly before it is needed again and the hit rate collapses toward zero.