Client
API
API Contract
Client asks. API responds. Your UI updates.
Caching is a performance feature and a correctness feature.

Why Cache-Control Matters

Cache-Control tells browsers, CDNs, and proxies how to store and reuse responses. Good caching improves speed and cuts backend load.

Use max-age for Freshness

A response with `max-age=60` can be reused for 60 seconds without rechecking with the server.

Public vs Private Caches

`public` allows shared caches like CDNs. `private` means only the end-user browser should store it.

Revalidate with ETag

Clients can send `If-None-Match` to ask whether cached content changed. If unchanged, server returns 304 with no body.

no-cache Is Not no-store

`no-cache` allows storage but requires revalidation before reuse. `no-store` forbids storing the response at all.

CDN Strategy with s-maxage

Use `s-maxage` to control shared caches separately from browsers. This is common for public API read endpoints.

Cache-Control Concepts Locked In

You can now design cache headers that improve speed without serving stale or sensitive data incorrectly.

AlgoAnimator: Interactive Data Structures