SAG / ARCHITECTURE NOTE

Cache Keys and Versions: Keeping Fast Results from Becoming Stale

Explains what caches are and why they are needed, how they work, and how to apply them in the SAG architecture, with practical checklists and references to research and official documentation.

Download Markdown

One-sentence definition

A cache is a storage strategy that reuses results for the same input and execution conditions, while automatically separating results when those conditions change.

Key answer: If you use only the URL as the cache key, stale results may be returned even when the question, language, rules, or model have changed. Conversely, if the key is too granular, the benefits of reuse disappear.

Why is this technology needed?

If you use only the URL as the cache key, stale results may be returned even when the question, language, rules, or model have changed. Conversely, if the key is too granular, the benefits of reuse disappear.

How it works

Include the tenant, normalized input hash, rules, schema and model versions, and ingestion conditions in the key, and define a TTL and explicit invalidation policy.

When designing a system, do not consider accuracy alone. Define latency, cost, data boundaries, refresh intervals, and behavior on failure as well, so results are reproducible in production. It is safer to leave values that automation cannot determine with confidence in an unmeasured or needs-review state rather than converting them to 0 or success.

How this relates to SAG technology

SAG's queue, cache, and run share the same input hash contract. Including the tenant scope in the key prevents data mixing caused by reusing results across customers.

Practical checklist

  • Include the tenant and input hash in the key
  • Invalidate by version when rules change
  • Record cache hits in provenance
  • Distinguish the states of failures, empty results, and authorization errors from success
  • Revalidate before and after changes under the same conditions

Research and official documentation

Reference documents support principles and recommendations. They do not guarantee search visibility, AI mentions, rankings, or revenue; the actual effects of an implementation must be verified through observations of service data under the same conditions.

Technical references by topic

How to continue reading about this technology

Explore tenant permissions, job retries, caching, and approval history.

Articles