Skip to content
mentoor

Caching strategies for LLM apps

For engineers

Choosing between provider prompt caching, exact-match response caches, semantic caches and tool-result caches, and keeping them from serving stale, leaked or wrong answers

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

A provider prompt-cache hit happens on a request. What still runs?

Choose one answer

Check yourself · 2 of 5

A response cache is keyed on the user message only. What breaks first when the team edits the system prompt?

Choose one answer

Check yourself · 3 of 5

What does raising a semantic cache's similarity threshold do?

Choose one answer

Check yourself · 4 of 5

Which agent tool call must never be served from a cache?

Choose one answer

Check yourself · 5 of 5

A cached answer says "Your balance is 240" and the key is the question text. What is the main risk?

Choose one answer

Topics

  1. Where provider prompt caching fits in the stack4 min read · Provider prompt caching makes a repeated prefix cheaper and faster but still runs the model; comparing it with caches that skip the call, and tracking hit rate per route
  2. Exact-match response caching with safe keys5 min read · Caching whole responses for repeated deterministic requests, with a key that includes model, prompt version, parameters, tools and the user or tenant scope, plus a time to live
  3. Semantic caching by embedding similarity5 min read · Embedding each query, returning a cached answer when a near neighbour passes a similarity threshold, and tuning that threshold on labelled query pairs to keep false hits low
  4. Caching tool and retrieval results in agents5 min read · Which tool calls, search results and embeddings in an agent run can be reused, for how long, and which must always be fresh because they read live state or cause side effects
  5. Stale, leaked and wrong cached answers5 min read · Answers that outlive the source they came from, personalised answers served to another user, a cached hallucination repeated to thousands, and invalidation on prompt or model change

Start here

110 questions · last verified 2026-12