HttpResponse::AddCacheItemDependency Method
Makes the validity of a cached response dependent on another item in the cache.
Assembly: System.Web (in System.Web.dll)
Parameters
- cacheKey
- Type: System::String
The key of the item that the cached response is dependent upon.
When the item corresponding to the cacheKey parameter is removed from the cache, the cached response of the current item is invalid.
The following example is an ASP.NET user control that is output cached. The code for the control calls the AddCacheItemDependency method with the key of an item stored in the Cache object passed as its parameter. If the item does not exist in the cache, the control's response that was stored in the output cache is invalidated. This means that on the subsequent request, a new version of the control's response will be added to the output cache.
Next, the code checks whether an item associated with a bookData key is stored in the Cache object, and displays one of two lines of text dependent upon the result. Then, the code sets the DataSource property of a DataGrid control, which is named dgBooks, with a call to a custom DataHelper class's shared GetBookData method, and populates the DataGrid with the DataBind method.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.