Image for LRU Cache (Least Recently Used Cache)

LRU Cache (Least Recently Used Cache)

An LRU Cache is a system that temporarily stores data to quickly access frequently used information. When the cache reaches its capacity, it removes the least recently accessed item to make room for new data. This approach ensures that the most relevant and actively used information stays readily available, improving performance by reducing the need to fetch data from slower storage. Think of it like a favorited playlist where the most recently played songs stay at the top, and the oldest ones are removed when space runs out.