羊皮纸论坛

羊皮纸论坛

分享让知识传播,阅读让心灵成长, 创作让文化传承,让我们共同努力。
  • 禁止广告文
  • 知识传播
  • 阅读
  • 心灵成长
  • 创作
  • 文化传承
羊皮纸论坛目录 / 程式设计 / 网页/网站程式 / PHP /

控制网页快取的方法

发表新主题
随机主题
上个主题
下个主题
|
控制网页快取的方法

Any valid HTTP headers can be put in these files. This provides another way to apply the Expires header, and it's a way to add the Cache-Control headers. The relevant Cache-Control headers are:
  • Cache-Control : max-age = [delta-seconds]
    Modifies the expiration mechanism, overriding the Expires header. Max-age implies Cache-Control : public.
  • Cache-Control : public
    Indicates that the object may be stored in a cache. This is the default.
  • Cache-Control : private
  • Cache-Control : private = [field-name]
    Indicates that the object (or specified field) must not be stored in a shared cache and is intended for a single user. It may be stored in a private cache.
  • Cache-Control : no-cache
  • Cache-Control : no-cache = [field-name]
    Indicates that the object (or specified field) may be cached, but may not be served to a client unless revalidated with the origin server.
  • Cache-Control : no-store
    Indicates that the item must not be stored in nonvolatile storage, and should be removed as soon as possible from volatile storage.
  • Cache-Control : no-transform
    Proxies may convert data from one storage system to another. This directive indicates that (most of) the response must not be transformed. (The RFC allows for transformation of some fields, even with this header present.)
  • Cache-Control : must-revalidate
  • Cache-Control : proxy-revalidate
    Forces the proxy to revalidate the page even if the client will accept a stale response. Read the RFC before using these headers, there are restrictions on their use.

Example:

<meta http-equiv="Cache-Control" content="max-age=3600">
<meta http-equiv="Expires" content="Tue, 01 Jan 1980 1:00:00 GMT">

Caveats and gotchas


  • HTTP/1.0 has minimal cache control and only understands the Pragma: no-cache header. Caches using HTTP/1.0 will ignore the Expires and Cache-Control headers.

    None of the Cache-Control directives ensure privacy or security of data. The directives "private" and "no-store" assist in privacy and security, but they are not intended to substitute for authentication and encryption.

    This article is not a substitute for the RFC. If your are implementing the Cache-Control headers, do read the RFC for a detailed description of what each header means and what the limits are.
  • 关键字 : Control, Cache, cache, headers, header, stored, private, field, Indicates, Expires, storage, revalidate, object, using, these, substitute, store, specified, security, response
0 0
2008-06-09T10:32:00+0000


  • 当您未登入羊皮纸时,可以利用脸书 Facebook 登入来发表回响。若使用羊皮纸会员身份发表回响则可获得经验值及虚拟金币,用来参加羊皮纸推出的活动。
发表回响
 
验证字串