RaccoonNotesGif

Browser Cache

Targets of caching operations

HTTP caching is optional, but reusing a cached resource is usually desirable. However, common HTTP caches are typically limited to caching responses to GET and may decline other methods. The primary cache key consists of the request method and target URI (oftentimes only the URI is used as only GET requests are caching targets). Common forms of caching entries are:

Successful results of a retrieval request: a 200 (OK) response to a GET request containing a resource like HTML documents, images or files. Permanent redirects: a 301 (Moved Permanently) response. Error responses: a 404 (Not Found) result page. Incomplete results: a 206 (Partial Content) response. Responses other than GET if something suitable for use as a cache key is defined. A cache entry might also consist of multiple stored responses differentiated by a secondary key, if the request is target of content negotiation. For more details see the information about the Vary header below.

Pros

Cons

Cache Header

Respond HeaderPragmaCache-ControlExpiresE TagLast-Modified
快取過期相對時間 ( 單位:秒)絕對時間Key絕對時間
優先級最高中高中低最低
快取類型強快取強快取強快取協商快取協商快取
排他性XXXX

Pragma

Cache-Control

Expires

E Tag

Last-Modified