@@ -526,11 +526,9 @@ the application whether or not the cached response is still valid. If the
526
526
cache *is * still valid, your application should return a 304 status code
527
527
and no content. This tells the cache that it's ok to return the cached response.
528
528
529
- Under this model, you mainly save bandwidth as the representation is not
530
- sent twice to the same client (a 304 response is sent instead). But if you
531
- design your application carefully, you might be able to get the bare minimum
532
- data needed to send a 304 response and save CPU also (see below for an implementation
533
- example).
529
+ Under this model, you only save CPU if you're able to determine that the
530
+ cached response is still valid by doing *less * work than generating the whole
531
+ page again (see below for an implementation example).
534
532
535
533
.. tip ::
536
534
@@ -578,10 +576,10 @@ automatically sets the ``Response`` status code to 304.
578
576
579
577
.. note ::
580
578
581
- The ``If-None-Match `` request header equals the ``ETag `` header of the
582
- last response sent to the client for the particular resource. This is
583
-
BDF1
how the client and server communicate with each other and decide whether
584
- or not the resource has been updated since it was cached.
579
+ The cache sets the ``If-None-Match `` header on the request to the ``ETag ``
580
+ of the original cached response before sending the request back to the
581
+ app. This is how the cache and server communicate with each other and
582
+ decide whether or not the resource has been updated since it was cached.
585
583
586
584
This algorithm is simple enough and very generic, but you need to create the
587
585
whole ``Response `` before being able to compute the ETag, which is sub-optimal.
@@ -646,10 +644,10 @@ the ``Response`` will be set to a 304 status code.
646
644
647
645
.. note ::
648
646
649
- The ``If-Modified-Since `` request header equals the ``Last-Modified ``
650
- header of the last response sent to the client for the particular resource.
651
- This is how the client and server communicate with each other and decide
652
- whether or not the resource has been updated since it was cached.
647
+ The cache sets the ``If-Modified-Since `` header on the request to the ``Last-Modified ``
648
+ of the original cached response before sending the request back to the
649
+ app. This is how the cache and server communicate with each other and
650
+ decide whether or not the resource has been updated since it was cached.
653
651
654
652
.. index ::
655
653
single: Cache; Conditional get
0 commit comments