System.Web.Caching.AggregateCacheDependency Class

Combines multiple dependencies between an item stored in an ASP.NET application's System.Web.Caching.Cache object and an array of System.Web.Caching.CacheDependency objects. This class cannot be inherited.

See Also: AggregateCacheDependency Members


public sealed class AggregateCacheDependency : CacheDependency


The System.Web.Caching.AggregateCacheDependency class monitors a collection of dependency objects so that when any of them change, the cached item is automatically removed. The objects in the array can be System.Web.Caching.CacheDependency objects, System.Web.Caching.SqlCacheDependency objects, custom objects derived from System.Web.Caching.CacheDependency, or any combination of these.

The System.Web.Caching.AggregateCacheDependency class differs from the System.Web.Caching.CacheDependency class in that it allows you to associate multiple dependencies of different types with a single cached item. For example, if you create a page that imports data from a SQL Server database table and an XML file, you can create a System.Web.Caching.SqlCacheDependency object to represent a dependency on the database table and a System.Web.Caching.CacheDependency to represent the dependency on the XML file. Rather than making an Cache.Insert(string, object) method call for each dependency, you can create an instance of the System.Web.Caching.AggregateCacheDependency class with each dependency added to it. You can then use a single erload:System.Web.Caching.Cache.Insert call to make the page dependent on the System.Web.Caching.AggregateCacheDependency instance.


Namespace: System.Web.Caching
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0