共用方式為


Page.InitOutputCache 方法

定義

為目前網頁要求初始化輸出快取。

多載

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

為目前網頁要求初始化輸出快取。

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

為目前網頁要求初始化輸出快取。

InitOutputCache(OutputCacheParameters)

根據 OutputCacheParameters 物件,初始化目前頁面要求的輸出快取。

備註

這個方法不能從程式碼直接使用。 若要啟用及動作頁面的輸出快取,請使用下列其中一種方法:

  • 使用 @ OutputCache .aspx 檔案中的 指示詞,以宣告方式設定選項。
  • 使用 類別的方法和屬性 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 標頭。

location
OutputCacheLocation

其中一個 OutputCacheLocation 值。

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 標頭。

location
OutputCacheLocation

其中一個 OutputCacheLocation 值。

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 網頁

另請參閱

適用於