LRU (Least Recently Used) कॅशे असे आयटम बाहेर काढते जे क्षमता पूर्ण झाल्यावर सर्वांत लांब वेळ प्रवेश केलेले नाही. क्लासिक डिজाइन hash map (O(1) लुकअप) सह doubly linked list (O(1) पुनर्क्रमांकन) एकत्र करते, O(1) get आणि put देते.
दोन-संरचना डिजाइन
text
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)
