• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

Why does API return 304 Not Modified instead of JSON?

Formal Definition

Per Wikipedia: “HTTP caching lets clients and intermediaries store responses and revalidate via ETag, Last-Modified, Cache-Control and 304.”

Explanation

Caching is leftovers — second visit eats from fridge if still fresh, else asks if still good.

How It Works

  1. Server sends Cache-Control and ETag
  2. Client caches response
  3. Next request sends If-None-Match
  4. Server returns 304 if unchanged
  5. Client uses cached body

Visual Explanation

http_caching A Server B Cache A->B step 1 C Client B->C step 2

Semantic Network

semantic_http_caching THIS HTTP Caching REL1 Related THIS--REL1 related REL2 Prereq THIS--REL2 builds from

Key Properties

  • ETag strong validator
  • Cache-Control max-age governs freshness
  • 304 saves bandwidth

Real-World Example

Cache-Control: max-age=60
ETag: "abc"

Connections

Edge Cases & Gotchas

  • Caching with auth — private vs public
  • Stale while revalidate confusion