first, browser caching mechanism processLoad Web content for the first time
Load Web page content again
Ii. Interpretation of relevant termsEtag
The HTTP protocol specification defines etag as the entity value of the requested variable. Alternatively, ETag is a token (token) that can be associated with a Web resource. A typical web resource can be a Web page, but it may also be a JSON or XML document. The server is solely responsible for determining what the token is and what it means and delivering it to the client in the HTTP response header, the following is the format returned by the server side: ETag: The 50B1C1D4F775C61:DF3 client's query update format is this: If-none-match:w/" 50b1c1d4f775c61:df3 "If ETag does not change, then return to state 304 and do not return, which is the same as last-modified." Testing ETag is primarily useful when a breakpoint is downloaded.
Last-modified
When the browser first requests a URL, the server-side return status is 200, the content is the resource requested by the client, and a last-modified attribute marks the last time the file was modified on the server side.
The last-modified format looks like this:
Last-modified:fri, May 2006 18:53:33 GMT
The second time the client requests this URL, according to the HTTP protocol, the browser sends the If-modified-since header to the server asking if the file has been modified after that time:
If-modified-since:fri, May 2006 18:53:33 GMT
If the server-side resources do not change, the HTTP 304 (not Changed.) Status code is automatically returned, and the contents are empty, thus saving the amount of data transferred. When the server-side code changes or restarts the server, the resource is issued again, similar to the first request. This ensures that resources are not duplicated to the client and that the client is able to get the latest resources when the server changes. Expires
Expires is the RFC 2616 (http/1.0) Protocol and Web page cache-related fields. Used to control the expiration date of the cache, it should be noted that http/1.0 has a weaker caching control mechanism: PRAGMA, the use of http/1.0 cache will ignore expires and Cache-control headers.
Cache-control
Cache-control is the most important rule. This field is used to specify instructions that all caching mechanisms must obey in the entire request/response chain. These directives specify the behavior that prevents the cache from causing adverse interference to the request or response. These directives typically override the default caching algorithm. Caching instructions are one-way, meaning that the presence of a directive in a request does not imply that the same instruction will exist in the response.
The Cache-control definition is:
Cache-control = "Cache-control" ":" Cache-directive.
The caching of the Web page is controlled by the "Cache-control" in the HTTP message header, the common value has private, No-cache, Max-age, must-revalidate, etc., the default is private.