Cache-Control的值

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9

 

Cache-Control   = "Cache-Control" ":" 1#cache-directive
 

    cache-directive = cache-request-directive
         | cache-response-directive
    cache-request-directive =
           "no-cache"                          ; Section 14.9.1
         | "no-store"                          ; Section 14.9.2
         | "max-age" "=" delta-seconds         ; Section 14.9.3, 14.9.4
         | "max-stale" [ "=" delta-seconds ]   ; Section 14.9.3
         | "min-fresh" "=" delta-seconds       ; Section 14.9.3
         | "no-transform"                      ; Section 14.9.5
         | "only-if-cached"                    ; Section 14.9.4
         | cache-extension                     ; Section 14.9.6
     cache-response-directive =
           "public"                               ; Section 14.9.1
         | "private" [ "=" <"> 1#field-name <"> ] ; Section 14.9.1
         | "no-cache" [ "=" <"> 1#field-name <"> ]; Section 14.9.1
         | "no-store"                             ; Section 14.9.2
         | "no-transform"                         ; Section 14.9.5
         | "must-revalidate"                      ; Section 14.9.4
         | "proxy-revalidate"                     ; Section 14.9.4
         | "max-age" "=" delta-seconds            ; Section 14.9.3
         | "s-maxage" "=" delta-seconds           ; Section 14.9.3
         | cache-extension                        ; Section 14.9.6
    cache-extension = token [ "=" ( token | quoted-string ) ]

在C#代码中,可以设置Response.CacheControl为HttpCacheability的枚举值

NoCache
设置 Cache-Control: no-cache 标头。 如果没有字段名,则指令应用于整个请求,且在满足请求前,共享(代理服务器)缓存必须对原始 Web 服务器强制执行成功的重新验证。 如果有字段名,则指令仅应用于命名字段;响应的其余部分可能由共享缓存提供。

Private
默认值。 设置 Cache-Control: private 以指定响应只能缓存在客户端,而不能由共享(代理服务器)缓存进行缓存。

Server
指定响应仅缓存在源服务器上。 与 NoCache 选项相似。 客户机接收 Cache-Control: no-cache 指令,但文档是在原始服务器上缓存的。 等效于 ServerAndNoCache。

ServerAndNoCache
应用 Server 和 NoCache 的设置指示在服务器上缓存内容,而对服务器以外的其他对象都显式否定其缓存响应的能力。

Public
设置 Cache-Control: public 以指定响应能由客户端和共享(代理)缓存进行缓存。

ServerAndPrivate
指示响应只能在服务器和客户端缓存。 代理服务器不能缓存响应。

你可能感兴趣的:(职场,title,休闲,blank,cache-control)