Reprint-"Cache-control" common values are private, No-cache, Max-age, must-revalidate, etc.

Source: Internet
Author: User
Tags local time

Reprinted from Http://www.cnblogs.com/igin/archive/2008/05/04/1181056.html

The cache of the Web page is controlled by the "Cache-control" in the HTTP message header, and the common values are private, No-cache, Max-age, must-revalidate, etc., and the default is private. Its function is divided into the following situations according to different ways of re-browsing:

(1) Open a new window

If the value of the specified Cache-control is private, No-cache, Must-revalidate, the server will be re-accessed when the new window is opened. If you specify a max-age value, the server is not re-accessed in the time within this value, for example:
Cache-control:max-age=5
Indicates that access will not go to the server within 5 seconds of accessing this page


(2) Enter in the Address bar
If the value is private or must-revalidate (not the same as on the Web), the server will be accessed only on the first visit and will not be accessed at a later time. If the value is No-cache, it is accessed every time. If the value is Max-age, access is not repeated until it expires.


(3) Press Back button
If the value is private, must-revalidate, max-age, it is not re-accessed, and if it is no-cache, it is repeated every time


(4) Press the Refresh button
No matter what the value, it will be accessed repeatedly

When you specify a Cache-control value of "No-cache", accessing this page does not leave a page backup in the Temporary Internet Article folder.
Also, the cache is affected by specifying a value of "Expires". For example, to specify that the expires value is a long past time, then when you visit this network repeatedly press ENTER in the Address bar, then each time will be repeated access:
Expires:fri, Dec 1999 16:00:00 GMT

In ASP, the expires value can be controlled through the expires, ExpiresAbsolute properties of the response object, and response values are controlled by CacheControl properties of an object, for example:
Response.ExpiresAbsolute = #2000 -1-1# ' Specifies an absolute expiration time with the server local time, which is automatically converted to GMT time
Response.Expires = 20 ' Specifies the relative expiration time, in minutes, that indicates how many minutes have expired from the current time.
Response.CacheControl = "No-cache"
The expires value can be seen by viewing the temporary file's properties in the Temporary Internet folder, such as:

Reprint-"Cache-control" common values are private, No-cache, Max-age, must-revalidate, etc.

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.