SystemWebCachingSectionGroup.OutputCacheSettings Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan bagian yang outputCacheSettings terkandung dalam konfigurasi.
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
Nilai Properti
Objek OutputCacheSettingsSection.
- Atribut
Contoh
Contoh kode berikut menunjukkan cara mendapatkan OutputCacheSettingsSection objek dari file konfigurasi aplikasi Web yang ada.
// 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)
Keterangan
Objek OutputCacheSettingsSection mengacu pada bagian outputCacheSettings file konfigurasi.
Pengaturan cache output mengaktifkan atau menonaktifkan cache output persisten berbasis disk, menentukan lokasi untuk mempertahankan data yang akan di-cache, dan menentukan ukuran maksimum cache per aplikasi.
ASP.NET memungkinkan Anda untuk menyimpan beberapa versi respons halaman secara deklaratif dengan menggunakan atribut direktif @ OutputCache dan secara terprogram menggunakan properti dan metode kelas HttpCachePolicy.
Anda dapat mencapai hasil yang sama dengan mengonfigurasi aplikasi menggunakan OutputCacheSettingsSection atau jenisnya OutputCacheProfile .