A cached quote is useful only while its key identifies the same calculation. A route ID might be enough for a pure function. A document usually needs a version as well, and a mutable list cannot be used directly as a dictionary key.
You implement several small cache contracts before building an eviction policy. Keep presence separate from truthiness: a stored zero is a hit. Decide what changes invalidate an entry, and make that decision visible in the key or an explicit clear operation. The standard library supplies memoization, but it cannot infer those business rules. Each exercise checks repeated values and a boundary that can make an apparently correct cache return stale data.