語言

SystemWebCachingSectionGroup.OutputCacheSettings 屬性

定義

取得 outputCacheSettings 配置中包含的該區段。

public:
 property System::Web::Configuration::OutputCacheSettingsSection ^ OutputCacheSettings { System::Web::Configuration::OutputCacheSettingsSection ^ get(); };
[System.Configuration.ConfigurationProperty("outputCacheSettings")]
public System.Web.Configuration.OutputCacheSettingsSection OutputCacheSettings { get; }
[<System.Configuration.ConfigurationProperty("outputCacheSettings")>]
member this.OutputCacheSettings : System.Web.Configuration.OutputCacheSettingsSection
Public ReadOnly Property OutputCacheSettings As OutputCacheSettingsSection

屬性值

OutputCacheSettingsSection 物件。

屬性

範例

以下程式碼範例說明如何從現有網頁應用程式的設定檔取得該 OutputCacheSettingsSection 物件。


// Get the .<outputCacheSettings> section
OutputCacheSettingsSection outputCacheSettings=
    cachingSectionGroup.OutputCacheSettings;

// Display the number of existing 
// profiles.
int profilesCount = 
    outputCacheSettings.OutputCacheProfiles.Count;
msg = String.Format(
"Number of profiles: {0}\n",
profilesCount.ToString());

Console.Write(msg);
' Get the .<outputCacheSettings> section
Dim outputCacheSettings _
As OutputCacheSettingsSection = _
cachingSectionGroup.OutputCacheSettings

' Display the number of existing 
' profiles.
Dim profilesCount As Integer = _
outputCacheSettings.OutputCacheProfiles.Count
msg = String.Format( _
"Number of profiles: {0}" + _
ControlChars.Lf, profilesCount.ToString())

Console.Write(msg)

備註

物件 OutputCacheSettingsSection 指的是設定檔的該 outputCacheSettings 區段。

輸出快取設定可啟用或停用基於磁碟的持久輸出快取,定義持久化資料的位置,並指定每個應用程式最大快取大小。

ASP.NET 允許你透過使用 @ OutputCache 指令的屬性,並程式化地使用 HttpCachePolicy 類別的屬性與方法,宣告式快取多個版本的頁面回應。

你也可以透過配置應用程式 或 OutputCacheSettingsSection 類型 OutputCacheProfile 來達成相同的效果。

適用於

另請參閱