Open Agent School · Public worked example
Semantic Caching: meaning and example
Welcome! Take one idea with you today.
Semantic caching searches stored question-and-answer entries using a numerical representation of meaning, called an embedding. It can return a previous answer for a sufficiently similar request instead of generating a new one. Similarity is only a candidate-selection signal: access rights, policy versions, factual freshness and task equivalence still matter.
Picture it: A synthetic studio assistant stores a public answer about firing-class cancellations. The new query has distance 0.2 from that entry, below a 0.3 limit. The entry is ten minutes old with a thirty-minute lifetime and matching permission/version scope. A private booking question must not borrow another member’s answer just because its wording resembles it.
What is easy to mix up?
Negation, dates, identity and policy exceptions may preserve similarity while changing the answer. A safe cache needs explicit scope filters, invalidation and evaluated false-hit behavior; some tasks should bypass it.
Teaching example by Open Agent School. Source: Redis Vector Library - Cache LLM Responses, TTL and access filters.