Page.InitOutputCache 方法

定义

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

重载

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

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

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

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

InitOutputCache(OutputCacheParameters)

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

注解

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

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

有关详细信息,请参阅 缓存 ASP.NET 页

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 标头。

varyByParam
String

通过 GET 或 POST 方法收到的以分号分隔的参数列表,来自输出缓存的内容因参数而异。

例外

location 指定的值无效。

注解

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

另请参阅

适用于

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 标头。

varyByParam
String

通过 GET 或 POST 方法收到的以分号分隔的参数列表,来自输出缓存的内容因参数而异。

例外

location 指定的值无效。

注解

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

另请参阅

适用于

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 页面的代码声明块或代码隐藏文件中的语法进行访问。 有关详细信息,请参阅 缓存 ASP.NET 页

另请参阅

适用于