SystemWebCachingSectionGroup.OutputCacheSettings Egenskap

Definition

Hämtar avsnittet outputCacheSettings som finns i konfigurationen.

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

Egenskapsvärde

Objektet OutputCacheSettingsSection.

Attribut

Exempel

Följande kodexempel visar hur du hämtar OutputCacheSettingsSection objektet från konfigurationsfilen för ett befintligt webbprogram.


// 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)

Kommentarer

Objektet OutputCacheSettingsSection refererar till outputCacheSettings avsnittet i konfigurationsfilen.

Cacheinställningarna för utdata aktiverar eller inaktiverar diskbaserad beständig utdatacache, definierar platsen för lagring av data som ska cachelagras och anger den maximala storleken på cachen per program.

ASP.NET gör att du kan cachelagrar flera versioner av ett sidsvar deklarativt med hjälp av attribut i @ OutputCache-direktivet och programmatiskt med hjälp av egenskaperna och metoderna för klassen HttpCachePolicy.

Du kan uppnå samma resultat genom att konfigurera programmet med hjälp av OutputCacheSettingsSection typen eller OutputCacheProfile .

Gäller för

Se även