Caching and conditional requests — HTTP and REST · Foundations

The fastest request is the one never sent, and the next fastest is answered with "you already have it". Let caches keep what never changes, tag each cat with an ETag, answer 304 to a client whose copy is current, and refuse a write based on a copy that is not.

What you will learn

Read the theory for Caching and conditional requests

All HTTP and REST lessons

All Foundations courses

loading types…

What you'll learn

  • Control how long a response may be reused with Cache-Control, and tell no-cache from no-store
  • Tag a representation with an ETag and answer If-None-Match with 304 Not Modified
  • Prevent lost updates with If-Match, answering 412 for a stale write and 428 for one that names no version