HTTP caches are classified into strong cache and negotiation cache. The negotiation cache is enabled only when the strong cache fails to be matched.

Strong cache

Strong caching is controlled through Expires and cache-control. Cache-control stone HTTP1.1 takes precedence over Expires. Cache-control is more powerful, which can cause inconsistencies between server time and browser time

cache-control: max-age= 6666000
Copy the code

No-cache Bypasses the browser cache and goes directly to the negotiation cache no-store does not use any cache policy

Cache-Control: no-store, no-cache, no-transform, must-revalidate, max-age=0
Copy the code

Negotiate the cache

Last-modified&if-modified-since last-modified detects file changes through time stamps. The etag&if-none-match Etag value is an identifier string that can accurately sense changes in the file. The co-existence of last-Modified has a higher priority