Next is the second access speed, the second access speed is actually mostly used to cache, HTTP design has already considered the cache, the way to control HTTP cache three kinds:
Freshness, validation and effectiveness. Freshness, also known as TTL time to live, I remember this when we learn the network has also been used, this is the simplest way, using the header, the cache agent will be told to keep the state and regain the content between the need for how long.
Authentication, which is a method that provides the cache proxy with the ability to determine whether the old cache is available without a full resource. The browser can issue a request that contains if-modify-sinse. If the file on the server does not change, the server sends a response of 304 not modified, so the browser will use the files in the cache and will not be retrieved again.
Effectiveness, some operations after the browser will make the cache effective, most commonly, is to create a non-GET request to the same URL.
That's a lot to say, but we don't usually rewrite the header or do anything else. In fact, most browsers have a maximum cache size, and when the cache reaches that size, the least recently used items are removed from the cache, so cache entries that have not been used for long periods of time will be erased and we should keep the items more frequent.
Therefore, clearing the cache is based on user behavior and there is no reliable prediction. If the cache header is not considered, the browser may store what you do not want to save in the cache, without saving what you want.
As a result, developers need to write their own JavaScript code related to the cache application.
Front End-"learning experience"-improved mobile performance by 2