sqlCacheDependency Element for caching (ASP.NET Settings Schema) 

Defines the settings used by the SqlCacheDependency class for database caching and table-based polling against either Microsoft SQL Server 2000 or SQL Server 2005. This configuration setting has no effect when you use the <sqlCacheDependency> element in conjunction with query notifications on SQL Server 2005.

<sqlCacheDependency enabled="true|false" 

The following sections describe attributes, child elements, and parent elements.


Attribute Description


Required Boolean attribute.

Indicates whether changes are being polled for.


Optional Int32 attribute.

Sets the frequency with which the SqlCacheDependency class instance polls the database table for changes. This value corresponds to the number of milliseconds between successive pollings. It cannot be set to less than 500 milliseconds.

The default value is 1 minute.

Child Elements

Element Description


Optional element.

Contains one or more named SQL connections that can be used by the SqlCacheDependency class instance.

Parent Elements

Element Description


The required root element in every configuration file used by the common language runtime and the .NET Framework applications.


Specifies the root element for the ASP.NET configuration settings in a configuration file. Contains elements that configure ASP.NET Web applications and control how the applications behave.


Configures the cache settings for a Web application.

The following default <sqlCacheDependency> element is not explicitly configured in the machine configuration file or in the root Web.config file, but is the default configuration returned by application in the .NET Framework version 2.0.

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

The following example adds a SqlCacheDependency object to an ASP.NET application.

<sqlCacheDependency enabled="true" pollTime="30000">
    <add name="Pubs" connectionStringName="PubsConn" />

Configuration Section Handler


Configuration Member


Configurable Locations


Root-level Web.config

Application-level Web.config


IIS 5.0, 5.1 and 6.0

.NET Framework 2.0

Visual Studio 2005

Community Additions