A two-layer cache has a provider tier and a local tier. The provider tier is prefix caching: the model stores the computed key-value state for an identical prompt prefix and reuses it on the next request that starts with the same tokens, which skips the prefill work and bills the matched tokens at a reduced rate (OpenAI's prompt caching guide). The match is exact: a single changed character before the cache boundary breaks the hit (Modular's inference handbook).
The local tier is your own store of the prefixes you intend to reuse, plus the bookkeeping that tells your application which prefix to send first. It might hold prompt templates, document blocks or conversation prefixes you have already assembled. When the local tier is full, something has to be dropped, and that decision determines which prefixes you keep re-sending.
The economics are asymmetric in a way that surprises teams. Anthropic's 5-minute cache has a 5-minute lifetime by default and refreshes at no extra cost each time the cached content is used, so a prefix that keeps being read stays alive (Claude prompt caching docs). But a prefix you stop reading expires, and the next request that needs it pays the full write price again. Storage is not free either: writes bill above base input, while hits bill well below it. So a policy that keeps the wrong prefixes resident produces the worst of both outcomes, paying write premiums for content nobody reads.
That is the core argument for caring about eviction at all. If your local tier keeps the hot set, the provider tier keeps those prefixes warm and you pay hit rates on most input tokens. If your local tier keeps cold content, you pay write premiums on prefixes that then idle until they expire.



