1. Browser cache

It is divided into mandatory cache and negotiated cache

2. Force cache

Expires: The time the server returns data. When the browser sends a request again, if the time to send the request is less than the expires time, the server doesn’t need to request it. Cache-control, which has five values: public, private, no-cache, no-store, and max-age Public => cache all files. Private => cache browser files Max-age => no file is cached. Max-age => No file is cached. Max-age => No file is cached within the number time. 4. Cache-control has a higher priority than Expires

3. Negotiate cache

Negotiation cache, also known as weak cache, is used in the case of cache-control:no-cache in the request packet. When the browser sends a request again, the request header if-modified-since will access the server. After this time, whether the file data has been modified. If no, the server will return the status 304 and read the cache. Etag /if-none-match: Principle: Same as last-modified/if-modified-since, but eTAG returns an identifier returned by the server. If no modification is made, if-none-match is sent to the server. If no modification is made, it is matched

The flow chart of 4.