Blog Stats
  • Posts - 36
  • Articles - 0
  • Comments - 11
  • Trackbacks - 23

 

Cache Dependency in ASP.NET 2.0

One of the most interesting changes in the Whidbey's Cache object is that it now supports custom types of cache dependencies. In brief, a cache dependency represents a logical dependency between a cached item and a file(s), folder(s), or another cached item(s). When the dependency is broken (i.e., the file/folder/item changes), the bound cached item is removed from the cache.

CacheDependency dep = new CacheDependency(fileName, dateTime);
cache.Insert(key, value, dep);

In ASP.NET 1.1, the CacheDependency class is sealed and cannot be inherited to create custom classes. In ASP.NET 2.0 this is going to change. The benefit is that you can now extend the range of sensitive objects and use your own objects in addition to files, folders, and other cached items.

The most common type of custom dependency is a dependency set on a database table. For example, you run a query, store the results in a DataSet and place the DataSet into the Cache. Next, whenever the contents of the table changes the ASP.NET Cache automatically invalidates the entry meaning that it is time for you to refresh the data. This functionality, though, will be provided as a standalone class named SqlCacheDependency. It is worth noticing that this class works only with SQL Server 7.0 and newer and that the behavior changes significantly if you use SQL Server Yukon. (You can get a finer control over the changes in this case.)

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Feedback

# re: Cache Dependency in ASP.NET 2.0

Gravatar Hi,
How can i cache and uncache the page, showing current date and time, depending upon changes in the database table using Sql Server YUKON.

Regards,
Sachin 4/21/2004 7:01 AM | Sachin

# Cache Dependency in ASP.NET 1.1

Gravatar Hi ,
I want to using Caching in ASP.NET 1.1 and what to uncache if there is any change in database (SQL 2000) is there any way to do it with minimum efforts.

Thanks,
Bhavin Shah 6/22/2006 2:08 PM | Bhavin Sha

# Cache Dependency in ASP.NET 1.1

Gravatar Hi ,
I want to using Caching in ASP.NET 1.1 and what to uncache if there is any change in database (SQL 2000) is there any way to do it with minimum efforts.

Thanks,
Bhavin Shah
(bhavin.shah@fasttrackteam.com) 6/22/2006 2:09 PM | Bhavin Shah

# re: Cache Dependency in ASP.NET 2.0

Gravatar Hi, i read your article. It's nice to see, but some other articles represent that "we have used sql cache from sql 2000" I dont know which is applicable in the current IT. Can u clarify me, which is possible in sql2000 itself? 6/30/2008 7:18 AM | sabarish

# re: Cache Dependency in ASP.NET 2.0

Gravatar How to use system.web.caching.cachingdependency in .NET using ORacle database.......i am not using the oracle.web.caching..........

6/5/2009 1:43 AM | leo

# re: Cache Dependency in ASP.NET 2.0

Gravatar one has to keep into mind the limitations of asp.net cache as well (in-proc and stand alone nature). here is a good read about it

http://www.alachisoft.com/ncache/asp-net-cache.html 2/15/2011 7:03 AM | watson

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

 

 

Copyright © Ramesh Arimilli