A Service Cache in Front of a Catalogue

Caching can avoid repeated reading or rendering for requests with the same relevant inputs, according to a freshness contract.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace one detail request
  2. Account for changes
  3. Decide what a cached record is allowed to answer
  4. Include variant scopes in cache decisions

Trace one detail request

After rendering article 27 in one language, later requests of the same public representation can reuse it. Result caches explain the role of input keys.

Account for changes

Publishing a new version may require invalidation or a newly versioned key. Include personalization in the cache scope where appropriate. Private content cache policy explains that dependency.[1]

Decide what a cached record is allowed to answer

A catalogue cache can store item A at revision three. A later lookup can reuse that value within its permitted freshness interval. If the display requires revision four immediately after an edit, the earlier cache entry needs invalidation or another read path. See invalidation after a data change.

Miss: read authoritative catalogue v3
Hit: serve cached v3 during allowed interval
Edit: catalogue publishes v4
Apply the chosen freshness or invalidation rule

Include variant scopes in cache decisions

Different tenants, locales or viewer contexts can produce distinct data for the same item ID. Use the full answer-determining key. Test two variants and a cached absence becoming present.

References

  1. Google, Site Reliability Engineering ↩