Skip to the page
Tecyfy

Prompting interview question · medium

You added prompt caching to an LLM app, but the usage numbers show almost no cache reads. What do you check first?

The short answerA prompt cache only matches an identical prefix, so look for whatever makes the start of each request differ.

The full answer

A prompt cache only matches an identical prefix, so look for whatever makes the start of each request differ. In order: is anything dynamic near the top (a timestamp, a user name, a request ID in the system prompt)? Are tools or their order changing between calls? Is the prompt long enough to be cached at all? Do requests come often enough to beat the cache lifetime? And is the cache marker, on Claude, placed after the shared part?

1. Read the usage fields first

ProviderField that shows a hitField that shows a write
Claudecache_read_input_tokenscache_creation_input_tokens
OpenAIusage.prompt_tokens_details.cached_tokens(automatic)

Writes on every call and no reads means the prefix changes every time. No writes at all means nothing was eligible.

2. The usual causes

SymptomCauseFix
Writes every call, never readsA date, ID or user field in the system promptMove it to the last user message
Hits drop after a deployTool list built from a dict or set, order changesSort tools; keep definitions byte-identical
No caching at allPrompt shorter than the minimum (for example 1,024 tokens on OpenAI)Cache only long shared prefixes
Hits at peak, misses at nightGaps longer than the cache lifetime (5 minutes by default on Claude)Use the 1-hour cache, or accept misses
Claude: no reads despite stable textcache_control placed before the part that repeats, or on the changing turnPut the breakpoint at the end of the shared block
OpenAI: low hits across many serversRequests spread over machinesSet prompt_cache_key per shared prefix

3. Lay the prompt out for caching

[tools]  [system prompt]  [examples, documents]  | cache here |  [conversation]  [new question]
  never changes ........................................          changes every call

4. Prove it

Send the same request twice within a minute and compare usage. If the second still shows no read, diff the 2 raw request bodies: the first byte that differs is the bug.

See Prompt Caching, and the prompt caching calculator for what a fixed cache saves.

What interviewers want: the prefix rule, reading the usage fields before guessing, dynamic content near the top as the first suspect, tool order, the minimum length and the lifetime, and a 2-request test with a diff of the bodies.

Last updated 22 October 2026

Sources

Where each fact comes from

  1. 1Prompt caching
  2. 2Prompt caching