Page.InitOutputCache 方法

定义

初始化当前页请求的输出缓存。

重载

名称 说明
InitOutputCache(Int32, String, String, OutputCacheLocation, String)

初始化当前页请求的输出缓存。

InitOutputCache(Int32, String, String, String, OutputCacheLocation, String)

初始化当前页请求的输出缓存。

InitOutputCache(OutputCacheParameters)

根据对象 OutputCacheParameters 初始化当前页请求的输出缓存。

注解

此方法不应直接从代码使用。 若要为页面启用和操作输出缓存,请使用以下方法之一:

  • 使用 .aspx 文件中的 @ OutputCache 指令以声明方式设置选项。
  • 使用类的方法和属性 HttpCachePolicy ,该类由 Response.Cache 页面代码中的对象公开。

有关详细信息,请参阅 Caching ASP.NET Pages

InitOutputCache(Int32, String, String, OutputCacheLocation, String)

初始化当前页请求的输出缓存。

protected:
 virtual void InitOutputCache(int duration, System::String ^ varyByHeader, System::String ^ varyByCustom, System::Web::UI::OutputCacheLocation location, System::String ^ varyByParam);
protected virtual void InitOutputCache(int duration, string varyByHeader, string varyByCustom, System.Web.UI.OutputCacheLocation location, string varyByParam);
abstract member InitOutputCache : int * string * string * System.Web.UI.OutputCacheLocation * string -> unit
override this.InitOutputCache : int * string * string * System.Web.UI.OutputCacheLocation * string -> unit
Protected Overridable Sub InitOutputCache (duration As Integer, varyByHeader As String, varyByCustom As String, location As OutputCacheLocation, varyByParam As String)

参数

duration
Int32

输出缓存中存储的对象有效时间。

varyByHeader
String

输出缓存中内容的分号分隔标头列表将有所不同。

varyByCustom
String

Vary HTTP 标头。

location
OutputCacheLocation

其中一个 OutputCacheLocation 值。

varyByParam
String

GET 或 POST 方法接收的参数的分号分隔列表,输出缓存中的内容将有所不同。

例外

location. 指定了无效值。

注解

不应调用此方法。 若要为页面启用和操作输出缓存,请使用 @ OutputCache .aspx文件中的指令或类的方法和属性 HttpCachePolicy 。 后者可通过 Response.Cache 页面代码中的语法进行访问。 有关详细信息,请参阅 Caching ASP.NET Pages

另请参阅

适用于

InitOutputCache(Int32, String, String, String, OutputCacheLocation, String)

初始化当前页请求的输出缓存。

protected:
 virtual void InitOutputCache(int duration, System::String ^ varyByContentEncoding, System::String ^ varyByHeader, System::String ^ varyByCustom, System::Web::UI::OutputCacheLocation location, System::String ^ varyByParam);
protected virtual void InitOutputCache(int duration, string varyByContentEncoding, string varyByHeader, string varyByCustom, System.Web.UI.OutputCacheLocation location, string varyByParam);
abstract member InitOutputCache : int * string * string * string * System.Web.UI.OutputCacheLocation * string -> unit
override this.InitOutputCache : int * string * string * string * System.Web.UI.OutputCacheLocation * string -> unit
Protected Overridable Sub InitOutputCache (duration As Integer, varyByContentEncoding As String, varyByHeader As String, varyByCustom As String, location As OutputCacheLocation, varyByParam As String)

参数

duration
Int32

输出缓存中存储的对象有效时间。

varyByContentEncoding
String

输出缓存中内容的字符集(内容编码)的分号分隔列表将有所不同。

varyByHeader
String

输出缓存中内容的分号分隔标头列表将有所不同。

varyByCustom
String

Vary HTTP 标头。

location
OutputCacheLocation

其中一个 OutputCacheLocation 值。

varyByParam
String

GET 或 POST 方法接收的参数的分号分隔列表,输出缓存中的内容将有所不同。

例外

location. 指定了无效值。

注解

不应调用此方法。 若要为页面启用和操作输出缓存,请使用 @ OutputCache .aspx文件中的指令或类的方法和属性 HttpCachePolicy 。 后者可通过 Response.Cache 页面代码中的语法进行访问。 有关详细信息,请参阅 Caching ASP.NET Pages

另请参阅

适用于

InitOutputCache(OutputCacheParameters)

根据对象 OutputCacheParameters 初始化当前页请求的输出缓存。

protected public:
 virtual void InitOutputCache(System::Web::UI::OutputCacheParameters ^ cacheSettings);
protected internal virtual void InitOutputCache(System.Web.UI.OutputCacheParameters cacheSettings);
abstract member InitOutputCache : System.Web.UI.OutputCacheParameters -> unit
override this.InitOutputCache : System.Web.UI.OutputCacheParameters -> unit
Protected Friend Overridable Sub InitOutputCache (cacheSettings As OutputCacheParameters)

参数

cacheSettings
OutputCacheParameters

包含缓存设置的一个 OutputCacheParameters

例外

找不到缓存配置文件。

-或-

缺少指令或配置设置配置文件属性。

输出缓存设置位置无效。

注解

不应调用此方法。 若要为页面启用和操作输出缓存,请使用 @ OutputCache .aspx文件中的指令或类的方法和属性 HttpCachePolicy 。 后者可通过 Response.Cache 页面代码声明块或代码隐藏文件中的语法进行访问。 有关详细信息,请参阅 Caching ASP.NET Pages

另请参阅

适用于