# Prompt caching

> Prompt caching: Keeping the KV cache of a prompt's shared opening, such as a system prompt or long document, so later requests that start with the…

Canonical: https://llmdojo.dev/glossary/prompt-caching

Also called prompt cache, prefix cache, prefix caching, context cache, context caching.

Keeping the KV cache of a prompt's shared opening, such as a system prompt or long document, so later requests that start with the identical prefix skip prefilling it.

Learn it in the lesson: [Sharing a prefix across requests](https://llmdojo.dev/learn/inference-optimization/caching-repeated-work/sharing-a-prefix) (Inference and Model Optimization · Caching Repeated Work: Prompts, Prefixes and Answers).

## Interview questions about Prompt caching

- [When does a prompt cache make the input bill higher rather than lower?](https://llmdojo.dev/interview/q/when-does-a-prompt-cache-make-the-input-bill-higher-rather-than)
- [A code assistant sends a 2,000-token system prompt and writes long answers. Users complain answers take too long to finish. Will a prefix cache fix it?](https://llmdojo.dev/interview/q/a-code-assistant-sends-a-2-000-token-system-prompt-and-writes)
- [What is system-prompt caching, and what does it actually save?](https://llmdojo.dev/interview/q/what-is-system-prompt-caching-and-what-does-it-actually-save)
- [Name three caches that reuse work when serving an LLM, and the scope of each.](https://llmdojo.dev/interview/q/name-three-caches-that-reuse-work-when-serving-an-llm-and-the)
- [Someone added today's date as the first line of every prompt, and the prompt-cache hit rate dropped to zero. Why, and how should prompts be laid out?](https://llmdojo.dev/interview/q/someone-added-today-s-date-as-the-first-line-of-every-prompt)
- [Design a backend where clients submit LLM prompt jobs and poll or receive callbacks, with queueing, model routing, prompt versioning, idempotency and cost control.](https://llmdojo.dev/interview/q/design-a-backend-where-clients-submit-llm-prompt-jobs-and-poll-or)
- [Your feature costs too much. Which levers do you compare?](https://llmdojo.dev/interview/q/your-feature-costs-too-much-which-levers-do-you-compare)
- [You're under 60 requests a minute but still get 429s. Why?](https://llmdojo.dev/interview/q/you-re-under-60-requests-a-minute-but-still-get-429s-why)

## Related
- [Exact caching](https://llmdojo.dev/glossary/exact-caching)
- [Semantic caching](https://llmdojo.dev/glossary/semantic-caching)
- [Glossary of every term](https://llmdojo.dev/glossary)
