Ana cached /products with 60s SWR plus locale in the cache key, after pricing PM confirmed the staleness SLA.
task
ticketacme/api#88submitted by@anacreated21d ago
plansigned
Add a Redis cache in front of /products with a 60s TTL and stale-while-revalidate.
Key by querystring hash. Bypass cache when an admin auth header is present.
Track hit/miss ratio in @acme/observability.
findings3
performancedefendedf_1
Stale-while-revalidate may serve stale prices during pricing pushes
Pricing team pushes updates via a topic; SWR window of 60s may briefly show stale prices on product detail. Confirm SLA tolerates this.
Pricing PM signed off: 60s staleness is within the customer-facing SLA. Will subscribe to pricing.update topic in v2 to invalidate immediately.
decided —
conventionaddressedf_2
Observability registration present
Hit/miss ratio is wired through @acme/observability per team standard.
edge-casedefendedf_3
Querystring hash collision across locales
Two customers in different locales may share a cache entry if locale is read from header, not querystring. Confirm key dimensions.
Key now includes Accept-Language; verified locally with curl that en-US and de-DE produce different keys.