caching 要素 (ASP.NET 設定スキーマ)

[このドキュメントはプレビューのみを目的としており、以降のリリースで変更される可能性があります。プレースホルダーとして空白のトピックが含まれています。]

Web アプリケーションのキャッシュ設定を構成します。

<caching>
   <cache>...</cache>
   <outputCache>...</outputCache>
   <outputCacheSettings>...</outputCacheSettings>
   <sqlCacheDependency>...</sqlCacheDependency>
</caching>

属性および要素

以降のセクションでは、属性、子要素、および親要素について説明します。

属性

なし。

子要素

要素

Description

Cache

省略可能な要素です。

グローバルなアプリケーションのキャッシュ設定を定義します。

outputCache

省略可能な要素です。

アプリケーション全体の出力キャッシュ設定を指定します。

outputCacheSettings

省略可能な要素です。

アプリケーションのページに適用できる出力キャッシュ設定を指定します。

sqlCacheDependency

省略可能な要素です。

ASP.NET アプリケーションの SQL キャッシュ依存関係を構成します。

親要素

要素

Description

configuration

共通言語ランタイムおよび .NET Framework アプリケーションで使用されるすべての構成ファイルで必要なルート要素です。

System.web

構成ファイル内に含まれる ASP.NET の構成設定のルート要素を指定します。 ASP.NET Web アプリケーションを設定し、アプリケーションの動作方法を制御する構成要素を格納します。

解説

既定の構成

次の既定の caching 要素は、Machine.config ファイルやルートの Web.config ファイルでは明示的に構成されていませんが、.NET Framework version 2.0 においてアプリケーションによって返される既定の構成です。

<caching>
  <cache disableMemoryCollection = "false" 
    disableExpiration = "false" 
    privateBytesLimit = "0" 
    percentagePhysicalMemoryUsedLimit = "90" 
    privateBytesPollTime = "00:02:00"/>

  <outputCache enableOutputCache = "true" 
    enableFragmentCache = "true" 
    sendCacheControlHeader = "true" 
    omitVaryStar = "false" >
  </outputCache>

  <outputCacheSettings>
    <outputCacheProfiles>
      <clear />
      <add name = "" 
        enabled = "true" 
        duration = "-1" 
        location = "" 
        sqlDependency = "" 
        varyByCustom = "" 
        varyByControl = "" 
        varyByHeader = "" 
        varyByParam = "" 
        noStore = "false"/>
    </outputCacheProfiles>
  </outputCacheSettings>

  <sqlCacheDependency enabled = "true" 
    pollTime = "60000">
    <databases>
       <clear />
      <add name = "" 
        connectionStringName = "" 
        pollTime = "60000"/>
    </databases>
  </sqlCacheDependency>

</caching>

使用例

ページをサーバー上に 1 分間だけキャッシュし、ブラウザーのタイプとメジャー バージョンに応じて別のバージョンのページを格納する例を次に示します。

<outputCacheSettings>
  <outputCacheProfiles>
    <add name="ServerOnly" 
      duration="60" 
      varyByCustom="browser" 
      location="Server" />
  </outputCacheProfiles>
</outputCacheSettings>

この方法でキャッシュする必要のあるページをデザインするときは、次のディレクティブをページに追加する必要があります。

<%@ OutputCache CacheProfile="ServerOnly" %>

詳細については、「@ OutputCache」を参照してください。

要素情報

構成セクション ハンドラー

System.Web.Configuration.CacheSection

System.Web.Configuration.OutputCacheSection

System.Web.Configuration.OutputCacheSettingsSection

System.Web.Configuration.SqlCacheDependencySection

構成メンバー

System.Web.Configuration.SystemWebCachingSectionGroup

構成できる場所

Machine.config

ルート レベルの Web.config

アプリケーション レベルの Web.config

要件

IIS 5.0、5.1、および 6.0

.NET Framework 2.0

Visual Studio 2005

参照

処理手順

How to: Configure Specific Folders Using Location Settings

How to: Lock ASP.NET Configuration Settings

Reference

system.web 要素 (ASP.NET 設定スキーマ)

configuration 要素 (全般設定スキーマ)

caching の cache 要素 (ASP.NET 設定スキーマ)

caching の outputCache 要素 (ASP.NET 設定スキーマ)

caching の outputCacheSettings 要素 (ASP.NET 設定スキーマ)

caching の sqlCacheDependency 要素 (ASP.NET 設定スキーマ)

System.Configuration

System.Web.Configuration

概念

ASP.NET Caching Overview

ASP.NET Configuration File Hierarchy

Securing Configuration

Configuration Inheritance

その他の技術情報

全般構成設定 (ASP.NET)

ASP.NET 構成設定

Configuring ASP.NET Applications

ASP.NET Configuration Files

ASP.NET Configuration API