Front End-"learning experience"-improved mobile performance by 2

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.