Skip to content
Preptima
hardDesignConceptMidSeniorStaff

What goes into a cache key, and what happens when two requests that should get different responses collide on one?

6 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

The key must contain every request input that changes the response — identity, scope, locale, device class, active flags — because anything left out silently merges two different responses into one entry.

Was this answer helpful?

Likely follow-ups

  • You need to cache a response that differs only by which feature-flag bucket the user is in. How do you stop the key space multiplying by every flag?
  • Where does key normalisation live so that the CDN and the application cannot disagree about it?
  • A response went into the shared cache under the wrong key an hour ago. How do you purge it, and how do you prove it is gone?
  • How does Vary on Accept-Encoding differ in risk from Vary on Cookie, and why is one of them close to useless?

Related questions

Further reading

Related Topics