caching
LRU Cache
Least Recently Used — evicts the entry that hasn't been accessed for the longest time
Capacity0 / 5
Cache Hits0
Evictions0
Fill Rate0%
Cap
// doubly linked list — click a node to GET it
Cache empty — add items with PUT
Cache Slots
05 slots free5
// event log
No events yet.
// how it works
- Uses a HashMap + Doubly Linked List
- GET moves accessed node to head (MRU)
- PUT inserts at head; evicts tail (LRU) if full
- Both GET and PUT are O(1) time
- Click any node above to simulate GET
// trade-offs
- Great for temporal locality workloads
- O(1) operations with constant space
- Doesn't consider access frequency
- Scan pollution (sequential access evicts hot data)