The fastest API call is the one you don't make. HTTP has built-in caching primitives — use them.
Caching layers
Client cache → CDN / Edge → Reverse proxy → App cache (Redis) → Database
HTTP caching headers
// Public — CDN + browser can cache
Cache-Control: public, max-age=3600
// Private — only browser caches
Cache-Control: private, max-age=300
// Never cache (auth endpoints, mutations)
Cache-Control: no-store
// stale-while-revalidate: serve stale, refresh in background
Cache-Control: public, max-age=60, stale-while-revalidate=600// Server response:
ETag: "v2-abc123"
// Client's next request:
If-None-Match: "v2-abc123"
// Unchanged → 304 Not Modified (no body = saves bandwidth)
// Changed → 200 OK + new ETag + new body// Different languages = different cache entries
Vary: Accept-Language
// NEVER do this — disables CDN caching effectively
Vary: Authorization