HttpCachePolicy 类

定义

包含可用于设置特定于缓存的 HTTP 标头以及用于控制 ASP.NET 页输出缓存的方法。Contains methods for setting cache-specific HTTP headers and for controlling the ASP.NET page output cache.

public ref class HttpCachePolicy sealed
public sealed class HttpCachePolicy
type HttpCachePolicy = class
Public NotInheritable Class HttpCachePolicy
继承
HttpCachePolicy

注解

有关 HTTP 标头和控制缓存的背景信息,请参阅 RFC 2616:超文本传输协议-HTTP/1.1,在万维网联合会(W3C)网站上提供。For background information about HTTP headers and controlling caching, see RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1, available on the World Wide Web Consortium (W3C) Web site.

属性

UtcTimestampCreated

获取或设置 HttpCachePolicy 的协调世界时 (UTC) 中的时间戳。Gets or sets the timestamp in Coordinated Universal Time (UTC) for the HttpCachePolicy.

VaryByContentEncodings

获取用于区分输出缓存的 Content-Encoding 标头列表。Gets the list of Content-Encoding headers that will be used to vary the output cache.

VaryByHeaders

获取将用于改变缓存输出的所有 HTTP 标头的列表。Gets the list of all HTTP headers that will be used to vary cache output.

VaryByParams

获取由影响缓存的 HTTP GET 或 HTTP POST 接收的参数列表。Gets the list of parameters received by an HTTP GET or HTTP POST that affect caching.

方法

AddValidationCallback(HttpCacheValidateHandler, Object)

注册当前响应的验证回调。Registers a validation callback for the current response.

AppendCacheExtension(String)

指定将文本追加到 Cache-Control HTTP 标头。Appends the specified text to the Cache-Control HTTP header.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetCacheability()

获取 Cache-Control 指令。Gets the cache-control directive.

GetCacheExtensions()

获取缓存扩展。Gets the cache extensions.

GetETag()

获取 ETag。Gets the ETag.

GetETagFromFileDependencies()

获取状态,此状态指示是否已基于处理程序的文件依赖项的时间戳设置了 ETag 标头。Gets the status indicating whether the ETag header has been set based on the timestamps of the file dependencies of the handler.

GetExpires()

获取到期标头。Gets the expire header.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetIgnoreRangeRequests()

获取忽略范围请求的状态。Gets the status of ignore range requests.

GetLastModifiedFromFileDependencies()

基于处理程序文件依赖项的时间戳,获取 Last-Modified 标头集的状态。Gets the status of the Last-Modified header set to base on the timestamps of the file dependencies of the handler.

GetMaxAge()

获取 Cache-Control 最长时间。Gets the cache-control max age.

GetNoServerCaching()

获取当前响应的服务器缓存状态。Gets the status of server caching for the current response.

GetNoStore()

获取存储的状态。Gets the status of the store.

GetNoTransforms()

获取 HTTP No-Transform 指令的状态。Gets the status of the HTTP No-Transform Directive.

GetOmitVaryStar()

获取 vary: 标头的状态。Gets the status of the vary: header.

GetProxyMaxAge()

获取 HTTP Cache-Control:代理最长时间。Gets the HTTP Cache-Control: Proxy Max Age.

GetRevalidation()

获取 Cache-Control:用于反映 must-revalidate 或 proxy-revalidate 指令的标头。Gets the Cache-Control: header to reflect either the must-revalidate or proxy-revalidate directives.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
GetUtcLastModified()

以协调世界时 (UTC) 获取 Last-Modified HTTP 标头的值。Gets the value of the Last-Modified HTTP header in Coordinated Universal Time (UTC).

GetVaryByCustom()

获取用于改变 HTTP 缓存的自定义字符串。Gets the custom string that is used to vary the HTTP caching.

HasSlidingExpiration()

获取一个值,该值指定缓存是否具有可调过期策略。Gets a value which specifies whether the cache has a sliding expiration policy.

IsModified()

获取一个值,该值指定 HTTP 缓存是否已被修改。Gets a value which specifies whether the HTTP cache has been modified.

IsValidUntilExpires()

获取一个值,该值指定 ASP.NET 缓存是否应忽略客户端发送的使缓存失效的 HTTP Cache-Control 标头。Gets a value which specifies whether the ASP.NET cache should ignore HTTP Cache-Control headers sent by the client that invalidate the cache.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
SetAllowResponseInBrowserHistory(Boolean)

allow 参数为 true 时,将使响应在客户端浏览器“历史记录”缓存中可用,而不论服务器上所做的 HttpCacheability 设置是什么。Makes the response is available in the client browser History cache, regardless of the HttpCacheability setting made on the server, when the allow parameter is true.

SetCacheability(HttpCacheability)

Cache-Control 标头设置为 HttpCacheability 值之一。Sets the Cache-Control header to one of the values of HttpCacheability.

SetCacheability(HttpCacheability, String)

Cache-Control 标头设置为 HttpCacheability 值之一,并将扩展追加到指令。Sets the Cache-Control header to one of the values of HttpCacheability and appends an extension to the directive.

SetETag(String)

ETag HTTP 标头设置为指定的字符串。Sets the ETag HTTP header to the specified string.

SetETagFromFileDependencies()

基于处理程序的文件依赖项的时间戳设置 ETag HTTP 标头。Sets the ETag HTTP header based on the time stamps of the handler's file dependencies.

SetExpires(DateTime)

Expires HTTP 标头设置为绝对日期和时间。Sets the Expires HTTP header to an absolute date and time.

SetLastModified(DateTime)

Last-Modified HTTP 标头设置为提供的 DateTime 值。Sets the Last-Modified HTTP header to the DateTime value supplied.

SetLastModifiedFromFileDependencies()

基于处理程序的文件依赖项的时间戳设置 Last-Modified HTTP 标头。Sets the Last-Modified HTTP header based on the time stamps of the handler's file dependencies.

SetMaxAge(TimeSpan)

基于指定的时间跨度设置 Cache-Control: max-age HTTP 标头。Sets the Cache-Control: max-age HTTP header based on the specified time span.

SetNoServerCaching()

停止当前响应的所有源服务器缓存。Stops all origin-server caching for the current response.

SetNoStore()

设置 Cache-Control: no-store HTTP 标头。Sets the Cache-Control: no-store HTTP header.

SetNoTransforms()

设置 Cache-Control: no-transform HTTP 标头。Sets the Cache-Control: no-transform HTTP header.

SetOmitVaryStar(Boolean)

指定在按参数进行区分时,响应是否应该包含 vary: 标头。Specifies whether the response should contain the vary: header when varying by parameters.

SetProxyMaxAge(TimeSpan)

基于指定的时间跨度设置 Cache-Control: s-maxage HTTP 标头。Sets the Cache-Control: s-maxage HTTP header based on the specified time span.

SetRevalidation(HttpCacheRevalidation)

基于提供的枚举值,将 Cache-Control HTTP 标头设置为 must-revalidateproxy-revalidate 指令。Sets the Cache-Control HTTP header to either the must-revalidate or the proxy-revalidate directives based on the supplied enumeration value.

SetSlidingExpiration(Boolean)

将缓存过期从绝对时间设置为可调时间。Sets cache expiration to from absolute to sliding.

SetValidUntilExpires(Boolean)

指定 ASP.NET 缓存是否应忽略客户端发送的使缓存失效的 HTTP Cache-Control 标头。Specifies whether the ASP.NET cache should ignore HTTP Cache-Control headers sent by the client that invalidate the cache.

SetVaryByCustom(String)

指定自定义文本字符串,它用于改变已缓存的输出响应。Specifies a custom text string to vary cached output responses by.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于