Eviction policies determine which cached entries to remove when the cache is full and needs space
policy
or algorithm
that determines which item(s) to remove from a cache when it reaches its maximum
capacity. It’s a crucial aspect of cache management to maintain efficiency and performance.
Policy | Description | Typical Use |
---|---|---|
LRU (Least Recently Used) | Removes least recently used item | General-purpose caching |
LFU (Least Frequently Used) | Removes least accessed item | Skewed traffic where few items dominate |
FIFO (First In First Out) | Removes oldest inserted item | Simple caches |
Random | Removes a random item | High-throughput caches like Redis |
Time-based Expiry | Removes items after TTL expires | CDN, session storage |