Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Http cache validation rewording#3653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit into2.3fromhttp-cache-reword
Mar 19, 2014
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletionsbook/http_cache.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -526,11 +526,9 @@ the application whether or not the cached response is still valid. If the
cache *is* still valid, your application should return a 304 status code
and no content. This tells the cache that it's ok to return the cached response.

Under this model, you mainly save bandwidth as the representation is not
sent twice to the same client (a 304 response is sent instead). But if you
design your application carefully, you might be able to get the bare minimum
data needed to send a 304 response and save CPU also (see below for an implementation
example).
Under this model, you only save CPU if you're able to determine that the
cached response is still valid by doing *less* work than generating the whole
page again (see below for an implementation example).

.. tip::

Expand DownExpand Up@@ -578,10 +576,10 @@ automatically sets the ``Response`` status code to 304.

.. note::

The ``If-None-Match``requestheaderequals the ``ETag`` header of the
last response sent to the client for theparticular resource. This is
how theclient and server communicate with each other and decide whether
or not the resource has been updated since it was cached.
Thecache sets the``If-None-Match`` headeron therequest to the``ETag``
of the original cached response before sending therequest back to the
app. This ishow thecache and server communicate with each other and
decide whetheror not the resource has been updated since it was cached.

This algorithm is simple enough and very generic, but you need to create the
whole ``Response`` before being able to compute the ETag, which is sub-optimal.
Expand DownExpand Up@@ -646,10 +644,10 @@ the ``Response`` will be set to a 304 status code.

.. note::

The ``If-Modified-Since``requestheaderequals the ``Last-Modified``
headerof thelastresponsesent to theclient for the particular resource.
This is how theclient and server communicate with each other and decide
whether or not the resource has been updated since it was cached.
Thecache sets the``If-Modified-Since`` headeron the request to the ``Last-Modified``
of theoriginal cachedresponsebefore sending therequest back to the
app.This is how thecache and server communicate with each other and
decidewhether or not the resource has been updated since it was cached.

.. index::
single: Cache; Conditional get
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp