← Back to all articles
Nadia Volkova

Choosing a Cache Policy

A practical guide to deciding what can be cached, for how long, and when it must be refreshed.

performancewebarchitecture

Caching is a promise about freshness. Before adding a cache, define how stale the result is allowed to be and who can invalidate it.

Three questions

  • Is the response public or user-specific?
  • How expensive is it to compute?
  • What happens if the result is old?

An article index can tolerate a short delay. A permission decision usually cannot.

Content Typical policy Invalidation
Static assets Long-lived Filename change
Public article page Minutes to hours Publish event
User profile Short-lived Profile update
Authorization Minimal or none Immediate

Make freshness visible

When content can be stale, a timestamp helps:

Showing cached results from 2 minutes ago
Updated automatically when the source responds

This turns a hidden trade-off into an understandable product decision.

A cache should make a known compromise explicit, not make correctness accidental.