LRU cache (doubly linked list + map)
A map finds any key's node at once; a doubly linked list keeps them in order of use.
Accesses1, 2, 3, 1, 4, 1, 2, 5, 1, 3capacity 3
An empty cache with room for 3. Each number below is an access to that key.
- compare
- swap or write
- settled
Space play · ← → step · Home End jump · drag the strip to scrub