ANATOMYMEMORY / 001

Least recently used.

A small cache has a simple rule: keep what you use.
When it fills up, let the oldest access go.

LRU / 04
MOST RECENT
  1. A
  2. B
  3. C
  4. D
LEAST RECENT
REQUEST
Cartridge to watchFour resident cache slotsFetch dock / eviction trayEvery access renews recency. A hit reuses a resident entry; a miss brings one in from the left dock. When all four slots are occupied, the entry used least recently leaves through the right tray. Punched holes identify A–E.

A, B, C and D are already cached. Try C for a hit, then E for a miss.

HITS
0
MISSES
0
EVICTIONS
0

One access is enough. A new access makes a key most recent, even if another key was used many times before.

In software. A hash table finds the entry; a doubly linked list moves it to the recent end. The moving cartridges illustrate that change in order.