Damian Maclennan Blog

Damian's Datalog

ASP.NET Database Cache Invalidation

Rob Howard talks about the new database cache features in ASP.NET 2.0.

Currently one of the downsides of caching data is that your cache doesn't know if the data has changed. So you might end up with a ten minute latency to getÂfresh data updates appearing on a web site. The new version of ASP.NET is more data aware :

<%@ outputcache duration="3600" varybyparam="none" sqldependency="MyDatabase:Authors" %>

From the looks of this your ASP.NET application would need SELECT access on the table, which may not be ideal.

In the past I have seen some cool workarounds for this though, one used an extended stored proc to "touch" a text file. The extended proc could be called by a trigger when a table was updated. ASP.NET can watch the specified file and invalidate the cache when the file changes.

Legacy Comments


Rob Howard
2003-10-31
re: ASP.NET Database Cache Invalidation
Actually, you don't need SELECT access -- only EXECUTE access (we use a SPROC) and that requirement is only for the lookup table not the table your data originates from.

Damian
2003-11-01
re: ASP.NET Database Cache Invalidation
Then that is WAY cool!

Thanks Rob

hossein
2006-03-14
re: ASP.NET Database Cache Invalidation
would you mind; please send cache code to me
(how cache all of database in asp.net)