Cache Hit -> Cache successful revalidation -> Cache = revalidation failed cache miss
Cache_Control
Cacheability Explanation public Process the HTTP request is returned, provided this value cache_control, the representatives of any of the paths as an HTTP request returns the elapsed which (including an intermediate number of HTTP proxy server and issuing a client browser request), may be cached returned content operating private Only initiated the request on behalf of the browser can cache no_cache It can be cached locally, but each time the request is made, has to authenticate to the server, if the server is allowed to use the local cache no_store Local and proxy servers can not cache memory, each time re-request, get content no_transform Mainly used in proxy server does not allow format conversion - max_age 和 Expires
- The browser will first check the cache has expired, if not expired, do not initiate a request to the server directly using the local cache, which is called a cache hit.
- max_age: maximum cache time
- Expires: valid
- Both exist simultaneously, max_age be honored
- Etag 和 Last_Modified
- If you do not max_age and Expires label, or verification fails, the browser sends a request to the server, the browser has expired or content Last_Modified judgment by Etag browser cache.
- If you do not return expired 304 (the server has executed the request, but the response has not changed), this is called a cache re-validation is successful, update the local browser cache max_age and Expires, and uses the local cache.
- If expired, this is called a cache revalidation failure (cache miss), the new data is returned.
- Etag: the entity tag of the requested variables (with a corresponding client request header If_None_Match)
- Last_Modified: the last modified time of the requested variables (with a corresponding client request header If_Modified_Since)
- If both, it must verify, and both conditions are met will return 304
- If you do not max_age and Expires label, or verification fails, the browser sends a request to the server, the browser has expired or content Last_Modified judgment by Etag browser cache.