LRU Cache
Although the computer cannot see into the future and know for certain what a user’s next request will be, there are applications that enable the computer to make an educated guess as to what requests are upcoming. A number of cache eviction policies attempt to predict future requests based on looking at past requests. One such strategy is the least-recently-used eviction policy. In fact, least-recently-used, or LRU for short, is one of the most popular eviction policies in use today.
The term “LRU” describes which item we’ll be evicting. That is, we will evict whichever item was least recently used; in other words, which item was least recently requested. For instance, if we have a cache containing the items [1, 2, 3, 4], and our app ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access