You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A resource is cacheable if all of the following are true:
Status code was 200, 203, 300, 301, 410 (ignore 206, partial response
for now).
Method is GET or HEAD. Any other method (PUT, POST, DELETE) invalids the
cache for that url.
It has one of expires, cache-control/max-age, last-modified or etag,
and it does not have cache-control/no-cache or cache-control/no-store.
If present, expires must be in the future.
There are two ways to retrieve from the cache:
If header includes Expires (absolute) or max-age directive Cache-Control (delta relative to date served), then can
re-serve to future requests (if both specified, prefer max-age).
Possibly stale entry needs to be validated with server. Send additional If-Modified-Since (from Last-Modified) and If-None-Match
(from ETag). If valid, returns 304, otherwise returns full request.
New functions need:
parse_http_date()
parse_cache_control()
response_cacheable()
response_expiry() - using both expires and cache-control headers.
Possibly cache in request object.
response_update() - checks if a response is still valid using by response_expiry() and a conditional response as necessary. Constructs
new response if needed.
response_cache_info() - given a request extract all caching related information
and show in a convenient way for debugging.
http://httpbin.org/cache/n: Sets a Cache-Control header for n seconds.
Returns 200 unless an If-Modified-Since or If-None-Match header is provided,
when it returns a 304.
The text was updated successfully, but these errors were encountered:
A resource is cacheable if all of the following are true:
for now).
cache for that url.
and it does not have cache-control/no-cache or cache-control/no-store.
If present, expires must be in the future.
There are two ways to retrieve from the cache:
Cache-Control (delta relative to date served), then can
re-serve to future requests (if both specified, prefer max-age).
If-Modified-Since
(fromLast-Modified
) andIf-None-Match
(from
ETag
). If valid, returns 304, otherwise returns full request.New functions need:
parse_http_date()
parse_cache_control()
response_cacheable()
response_expiry()
- using both expires and cache-control headers.Possibly cache in request object.
response_update()
- checks if a response is still valid using byresponse_expiry()
and a conditional response as necessary. Constructsnew response if needed.
response_cache_info()
- given a request extract all caching related informationand show in a convenient way for debugging.
Useful links:
Testing
Returns 200 unless an If-Modified-Since or If-None-Match header is provided,
when it returns a 304.
The text was updated successfully, but these errors were encountered: