Cacheable
-
The method used in the request is cacheable
, that is either a
GET
or aHEAD
method. A response to aPOST
orPATCH
request can also be cached if freshness is indicated and theContent-Location
header is set, but this is rarely implemented. For example, Firefox does not support it (Firefox bug 109553 ). Other methods, likePUT
orDELETE
are not cacheable and their result cannot be cached. -
The status code of the response is known
by the application caching, and is cacheable
. The following status codes are cacheable:
200
,203
,204
,206
,300
,301
,404
,405
,410
,414
, and501
. -
There are no specific headers in the response, like
Cache-Control
, with values that would prohibit caching.
Note that some requests with non-cacheable responses to a specific URI may invalidate previously cached responses from the same URI. For example, a
PUT
to /pageX.html
will invalidate all cached responses to
GET
or
HEAD
requests to /pageX.html
.
When both the method of the request and the status of the response are cacheable, the response to the request can be cached:
GET
/
pageX.html
HTTP/1.1
(…)
200 OK
(…)
The response to a
PUT
request cannot be cached. Moreover, it invalidates cached data for requests to the same URI using
HEAD
or
GET
methods:
PUT
/
pageX.html
HTTP/1.1
(…)
200 OK
(…)
The presence of the
Cache-Control
header with a particular value in the response can prevent caching:
GET
/
pageX.html
HTTP/1.1
(…)
200 OK
Cache-Control
:
no-cache
(…)