LRU (Least Recently Used) evicts the entry that has gone the longest without being read or written. The assumption is that recently used data will be used again soon, which holds for most workloads. A classic implementation pairs a hash map for O(1) lookups with a doubly linked list that tracks access order. On every access you move the node to the front of the list, and when you need space you drop the node at the back.
LFU (Least Frequently Used) evicts the entry with the lowest access count. It is better than LRU when some items are popular over a long window but accessed in bursts, because LRU would wrongly evict a popular-but-idle item. The downside is that a once-hot item can get stuck in the cache forever on stale count, so production LFU usually decays counts over time. Redis implements an approximate LFU using an 8-bit counter with logarithmic increment and periodic decay.
FIFO (First In, First Out) evicts the oldest inserted entry regardless of how often it was used, which is simple and cheap but often performs worse than LRU. Random eviction just picks a victim at random, which sounds bad but is surprisingly competitive and very cheap, which is why Redis offers allkeys-random. More advanced policies like W-TinyLFU, used by the Caffeine library, combine a frequency sketch with a small recency window and beat plain LRU on most real traces.