Skill 2.4.3
Design and implement a caching strategy, including prompt caching, semantic caching, and response caching
Key Concepts
Prompt caching is applied by the model service: when requests share an identical prefix of sufficient length (1,024 tokens or more for Azure OpenAI models), the cached prefix is processed faster and billed at a discount. It requires stable content at the start of the prompt. Semantic caching stores answers with the embedding of the request and returns a stored answer when a new request is similar enough; the API Management AI gateway provides semantic cache policies backed by Redis.
Response caching stores exact results of deterministic operations, such as tool calls or retrieval queries, keyed by their inputs and with a TTL. Caches must respect user and tenant boundaries and data freshness; personalized or permission-dependent answers must not be served to other users from a shared semantic cache.