LRU (Least Recently Used) cache என்பது அதிகபட்ச திறனை அடைந்தபோது மிக நீண்ட நேரம் பயன்படுத்தப்படாத உপাদனத்தை வெளியேற்றும். கிளாசிக்கல் வடிவமைப்பு hash map (O(1) lookup) ஐயும் இரட்டை இணைப்பு பட்டியலை (O(1) மறுசீரமைப்பு) ஒன்றாக இணைக்கிறது, இது O(1) get மற்றும் put ஐ வழங்குகிறது.
இரண்டு கட்டமைப்பு வடிவமைப்பு
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)
