Caching a robot-related calculation creates two separate questions: whether an old result is appropriate to reuse, and which retained result to discard when space runs out. Least-recently-used eviction addresses the second question through access history. A hit changes that history even though it does not insert a new key.

An explicit key trace shows why LRU differs from first-in-first-out eviction and why neither policy is a universal predictor of the next access. The construction below is an abstract serial cache, not a Python execution, CPU measurement, or deployed perception pipeline.

Specify entries and access events

Assume three entries, initially empty. Each entry stores one distinct key and its associated reusable value. Every requested key has the same entry cost, and a miss inserts its result. There is no expiration, manual invalidation, prefetch, or concurrent request in this model.

LRU orders retained keys by their most recent access. On a hit it moves the accessed key to the most-recent position. On a miss with a full cache it removes the least-recent key, then inserts the new one as most recent.

FIFO instead orders entries by when they were inserted. A hit leaves this insertion order unchanged. A full-cache miss removes the oldest inserted entry. Cornell's cache notes document this policy distinction; Python's documentation provides a bounded memoization example of LRU semantics and the API qualifications discussed later.

Build one original ten-access trace

Request the keys in this order: A, B, C, A, D, B, A, C, D, A. In every bracket below, the leftmost LRU entry is the least recent and the rightmost is the most recent.

The first A, B, and C are misses. After them the cache is [A,B,C]. The fourth access, A, is a hit, and LRU changes the order to [B,C,A]. No value was newly computed for that access, but the future eviction choice changed.

The fifth access, D, misses and removes B, giving [C,A,D]. B then misses at access six and removes C, producing [A,D,B]. The seventh access, A, hits and gives [D,B,A].

Access eight requests C, evicting D and leaving [B,A,C]. Access nine requests D, evicting B and leaving [A,C,D]. The last A hits, yielding final order [C,D,A].

LRU therefore has hits only at positions four, seven, and ten: three hits and seven misses. Its hit fraction for this finite trace is 3/10. That is a count for these ten invented requests, not an estimated long-run performance rate.

Run the same requests through FIFO

FIFO also begins with [A,B,C], now read from oldest insertion to newest. Access four hits A but preserves that order. D at access five therefore removes A, leaving [B,C,D], unlike LRU's removal of B.

B at access six hits and stays in place. A at access seven misses, removes B, and produces [C,D,A]. The final requests C, D, and A all hit, leaving the same FIFO insertion order.

FIFO has five hits, at accesses four, six, eight, nine, and ten. On this trace it outperforms LRU's three hits despite ignoring hit recency. There is no contradiction: recency is an eviction rule based on past requests, not knowledge of future requests.

The caches retain the same set {A,C,D} at the end but reached it through different misses. A final cache snapshot alone cannot recover their historical hit totals.

Reuse distance counts distinct intervening keys

For a repeated key, define its reuse distance as the number of distinct other keys requested since its previous access. First accesses have no finite previous-use distance and are cold misses.

In a fully associative LRU cache of capacity C, a repeated key hits exactly when this distance is less than C. Every distinct intervening key can place one entry ahead of it in recency order. Repeated accesses to the same intervening key do not add another distinct entry.

The A at access four has intervening keys B and C, distance two, so it hits with capacity three. B at access six has seen C, A, and D since access two, distance three, so it misses. The A at access seven sees only D and B since access four, distance two, so it hits.

The later C and D each have distance three and miss, while the last A sees C and D, distance two, and hits. These distances independently reproduce all six repeated-key outcomes without replaying the stored values.

Counting intervening requests instead of distinct keys can overstate the distance when one key repeats. For example, the requests A,B,B,B,A have reuse distance one for the final A, not three. A capacity-two LRU cache retains A through those repeated B hits.

Change capacity without changing the trace

With capacity two, every repeated key in the ten-access trace has distance at least two, so LRU has zero hits. With capacity four, all four distinct keys fit; only their first appearances miss, giving six hits.

These results follow from the defined fully associative, equal-entry model. A hardware cache can restrict a block to a particular set, and variable-size software entries can impose a byte budget rather than an entry count. The simple distance criterion does not automatically describe those alternatives.

Validity and concurrency remain separate contracts

Suppose key A identifies a geometric calculation but omits the calibration version that affects its result. A perfect cache hit can then return a result from the wrong model version. Including an appropriate version in the key or invalidating entries addresses that semantic issue; changing LRU to FIFO does not.

Python's lru_cache documentation requires hashable arguments and exposes hits, misses, and current size through cache_info. Its maxsize=None setting removes the bound. The documentation also distinguishes coherent concurrent cache updates from a guarantee of one underlying function call: concurrent misses can compute the same call more than once.

None of those library features was executed here. The analytical trace retains explicit key identities, a serial event order, and the hit-refresh rule. Those details explain every eviction while keeping a favorable reuse pattern separate from the correctness of the reused value.

Sources checked October 24, 2026

Python functools documentation: lru_cache:

https://docs.python.org/3/library/functools.html

Cornell CS 3410 Spring 2026: Caches, eviction policies:

https://www.cs.cornell.edu/courses/cs3410/2026sp/notes/caches.html

Concept illustration: A small desktop robot beside a laptop showing a generic workflow provides robotics context for this analytical model. The image does not depict the article's numerical example, a verified experiment, a product specification, or deployment evidence.