ObjectDataSource.CacheKeyDependency Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a user-defined key dependency that is linked to all data cache objects that are created by the data source control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public virtual string CacheKeyDependency { get; set; }
/** @property */
public String get_CacheKeyDependency ()

/** @property */
public void set_CacheKeyDependency (String value)

public function get CacheKeyDependency () : String

public function set CacheKeyDependency (value : String)

Property Value

A key that identifies all cache objects created by the ObjectDataSource.

All cache objects are explicitly expired when the key is expired. This allows you to invalidate cache entries programmatically that are created by the ObjectDataSource from your own page code.

The ObjectDataSource control supports data caching. While data is cached, calls to the Select method retrieve data from the cache rather than from the business object that the ObjectDataSource works with. When the cache expires, the Select method retrieves data from the business object, and then caches the data again.

The ObjectDataSource control automatically caches data when the EnableCaching property is set to true and the CacheDuration property is set to a value greater than 0, which indicates the number of seconds that the cache stores data before the cache entry is discarded. A value of 0 indicates an infinitely long cache.

You can set the CacheKeyDependency property to create a dependency between all cache entries that are created by the ObjectDataSource control and the key. You can expire all the cache entries programmatically at any time by expiring the key.

A unique cache entry is created for every combination of the CacheDuration, CacheExpirationPolicy, TypeName, SelectMethod, and SelectParameters properties. Multiple ObjectDataSource controls can use the same cache entries in scenarios where they load data using the same type, method, and parameters.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0