当前位置:网站首页>Browser cache

Browser cache

2022-06-27 01:30:00 Big drumsticks are best

 Insert picture description here

Every time the browser makes a request , Both look in the browser cache for the result of the request and the cache identity

Each time the browser gets the result of a returned request, it stores the result and the cache id in the browser cache

The cache will be strengthened at the beginning

Forced caching is to find the result of the request from the browser cache

1, There is no such cache result and cache identity , Force cache invalidation , Then send a request directly to the server ( return 200)

2, There is the cache result and the cache identity , But the result is no longer valid , Force cache invalidation , Then use negotiation cache ,

The browser carries a cache id , Initiate request , If the resources are updated , And then return to the new result , Status code for 200, If the resource is not updated , Then return to 304, You can continue to use the cache file

3, There is the cache result and the cache identity , And this result has not been invalidated , Force cache to take effect , Return the result directly

Force the cache to take precedence over the negotiation cache , If cache is forced (Expires and Cache-Control) Take effect and use the cache directly , If it does not take effect, a negotiation cache is performed (Last-Modified / If-Modified-Since and Etag / If-None-Match), The negotiation cache is up to the server to decide whether to use the cache , If the negotiation cache expires , Then represents the cache invalidation of the request , Retrieve request results , This is then stored in the browser cache ; Return in effect 304, Continue using the cache , The main process is as follows :
 Insert picture description here

 

原网站

版权声明
本文为[Big drumsticks are best]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/178/202206270108272280.html