Una cache LRU (Least Recently Used) rimuove l'elemento che non è stato accessato per il tempo più lungo quando raggiunge la capacità. Il design classico combina una hash map (lookup O(1)) con una doubly linked list (riordinamento O(1)), ottenendo get e put O(1).
Il design a due strutture
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)
