Skip to main content
Cache eviction is a 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.

LRU Least Recently Used

LRU stands for Least Recently Used, which is a popular cache eviction policy used in computing. When a cache reaches its size limit and needs to make space for new items, LRU removes the item that has not been accessed or used for the longest time—i.e., the “least recently used” item is evicted.
LRU implementation

LFU Least Frequently Used

Evict the key with the lowest access frequency. Ties can be broken by recency or arbitrary order.
LFU

FIFO First in last out

Evict the oldest entry—i.e., the one that was inserted earliest.
LFU

Random Eviction

Evict a random entry when capacity is exceeded.