I have a pretty low tolerance for vague “optimize your AI costs” advice.
Most of it turns into a glossy architecture slide, a few arrows, and zero explanation of what actually reduces spend. Caching is one of the rare topics where the savings are real, measurable, and not that hard to implement if you understand the rules.
The core point is simple: in production, users ask the same things over and over, and we keep paying for the same tokens over and over.
There are really two different problems here:
Prompt caching helps when the repeated part of the request is literally identical.
Semantic caching helps when the user asks the same thing in different words.
That distinction matters a lot, because I still see teams mash these together as if “cache” is one feature.
With prompt caching, the details are annoyingly specific, which is exactly why they matter.
If your large system prompt stays fixed at the beginning of the request, you can get real savings because the provider can reuse that processed prefix. But this only works on exact text match. Not similar meaning. Not “basically the same prompt.” The same bytes.
A few practical gotchas stood out to me:
- prompt caching only kicks in once the prompt is large enough
- it grows in token boundary increments, not smoothly
- if you keep tweaking, reordering, or injecting dynamic content into your system prompt, you break the cache
That last one is the big one. I’ve seen teams sabotage their own caching by treating the system prompt like a template they can constantly mutate. If you want prompt caching to pay off, lock it down. Treat it like production config, not a playground.
The other important limitation: prompt caching doesn’t help when users paraphrase.
That’s where semantic caching becomes the practical layer I’d actually want in front of many LLM apps. Instead of asking “is this exact text already cached?”, you ask “have I seen this intent before?”
The implementation pattern is straightforward:
You embed the incoming query, compare it against stored embeddings of prior queries, and if the similarity clears your threshold, you return the cached answer instead of calling the model again.
That’s a meaningful difference because now:
- “What’s your refund policy?”
- “Can I return something I bought?”
- “How do refunds work?”
…can all hit the same cache path if your similarity threshold is set well.
This is also why semantic caching is more generally useful than provider-native prompt caching. It sits in your app layer, so it’s not tied to one model vendor’s feature set. If the model changes, your cache strategy doesn’t have to collapse with it.
I also liked the emphasis on Redis as infrastructure glue, not just “a cache.”
That’s the practical architecture point people miss. If you already have Redis in the stack, it can do more than semantic cache lookups:
- vector storage for RAG
- session memory
- rate limiting
- low-latency retrieval paths around expensive model calls
That’s the kind of component choice I like: one boring, fast system doing multiple useful jobs.
Not because Redis is magic. Just because operational simplicity matters, and adding one more database every time someone says “AI feature” is how systems get expensive and fragile.
The tradeoff discussion is the right one too.
If you want pure speed and simple caching, Redis makes sense.
If you need governance, security controls, throttling, and centralized policy, putting API management in front can be worth the extra complexity.
If you already live in a world where persistence, global distribution, and richer querying matter more than absolute cache speed, then Cosmos DB starts to make sense.
That’s the real architecture conversation. Not “what’s the best AI stack?” but which layer is solving which problem, and what are you optimizing for?
My main takeaway is this: caching for LLM apps should be treated as a first-class product and platform concern, not a late-stage optimization.
If you’re shipping anything with:
- a large stable system prompt
- repeated user intents
- multi-turn conversations
- RAG retrieval
- meaningful traffic
…then not thinking about caching early is basically volunteering to overpay.
And the best part is that this is not some speculative “AI strategy” nonsense. You can actually observe the impact:
- fewer fresh tokens
- lower latency on cache hits
- fewer model calls
- lower cost per interaction
That’s the standard I want more AI engineering content to meet: specific mechanics, clear constraints, actual tradeoffs.
Not “GenAI transformation.” Just here’s how to stop wasting money.