Interactive simulator for LRU (Least Recently Used) cache algorithm. Watch cache hits, misses, and evictions in real-time. Understand how LRU maintains the most recently accessed items while evicting the least recently used ones.
Why simulate LRU cache?
LRU is one of the most common cache replacement policies. This simulator helps you understand how cache hits, misses, and evictions work, and how cache capacity affects performance.
How LRU works
When the cache is full and a new item needs to be added, LRU evicts the least recently accessed item. The simulator shows the access order and highlights which items get evicted when capacity is reached.
Good for
- Understand cache replacement policies
- Visualize cache hit/miss patterns
- Test cache capacity planning
- Learn how LRU maintains access order
Questions people ask
What is LRU cache?
LRU (Least Recently Used) is a cache replacement policy that evicts the item that was accessed least recently when the cache is full. It keeps the most recently accessed items in memory.
When should I use LRU?
LRU works well when recently accessed items are likely to be accessed again soon. It's commonly used in CPU caches, database buffers, and web caches.