This project simulates a memory cache replacement system using the Least Recently Used (LRU) policy.
It demonstrates how real-world systems manage limited memory efficiently by evicting the least recently accessed data.
To design and implement an optimized LRU Cache with:
- O(1) time complexity
- Efficient memory management
- Real-time visualization of cache operations
- HashMap (Dictionary) → O(1) lookup
- Doubly Linked List → O(1) insertion & deletion
- Most recently accessed item → moved to front
- Least recently used item → removed when capacity exceeds
| Operation | Complexity |
|---|---|
| get() | O(1) |
| put() | O(1) |
| eviction | O(1) |
- Add key-value pairs to cache
- Access existing keys
- Automatic eviction of least recently used item
- Cache Hits counter
- Cache Misses counter
- Cache Size tracking
- Cache blocks displayed (MRU → LRU)
- MRU highlighted in green
- LRU highlighted in red
- Activity logs showing operations
- Automatically performs random operations
- Helps analyze cache behavior