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 типа.