Un cache LRU (Least Recently Used) elimină elementul care nu a fost accesat timp de cel mai lung interval atunci când atinge capacitatea. Designul clasic combină o hartă hash (O(1) căutare) cu o listă dublu înlănțuită (O(1) reordonare), oferind O(1) get și put.
Designul cu două structuri
HashMap: key -> node DLL (recency order):
MRU <-> ... <-> LRU
get/put: map finds node move touched node to front (MRU)
in O(1); DLL splices it evict the tail (LRU) when full
to the front in O(1)
