Caching and conditional requests
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
avoid sending data the client already has.
Planned topics
Cache-Controltells caches how long to keep a response (max-age=60) or not to (no-store).- An ETag is a version stamp for a response, for example a hash of the content.
- The client sends it back as
If-None-Match. If nothing changed, the server answers304 Not Modifiedwith no body. Last-ModifiedwithIf-Modified-Sincedoes the same using a date.- Never cache personalized or sensitive responses in shared caches: use
Cache-Control: privateorno-store.
Draft outline details
Demonstration
GET /products/5 -> 200, ETag: "v7", body
GET /products/5
If-None-Match: "v7" -> 304, no bodyCheck your understanding
What does 304 save?
Show answer
The body transfer; the client reuses its copy.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.