Skip navigation

Related Solutions

Several articles, including a .NET Developer Perspectives column that I wrote a few years ago ("Data Caching for Web Applications," August 21, 2001, InstantDoc ID 22925), address the topic of data caching for Web applications. Other authors have devised different solutions to the database cache dependency problem. In April 2003, Jeff Prosise's MSDN Magazine article, "Wicked Code: Supporting Database Cache Dependencies in ASP.NET" (http://msdn.microsoft.com/msdnmag/issues/03/04/WickedCode/default.aspx), addressed the database cache dependency issue in ASP.NET 1.x and SQL Server. His solution was to write triggers on the tables associated with caches. The triggers called an extended stored procedure that modified a file on a network share. An instance of the CacheDependency class in ASP.NET monitored the file and invalidated the cache whenever the file changed.

Rob Howard also wrote and posted a helpful demo (which you can download at http://gotdotnet.com/team/rhoward/SQLDependency.zip) that applied almost the same concept, but his code dynamically created the cache dependency and associated trigger from the client, an ASP.NET Web application. Instead of modifying a file through an extended stored procedure, Howard's extended stored procedure made an HTTP call back to the Web server to expire the associated cache. In a series of two articles, "Invalidating an ASP.NET Web Application Cache Item from SQL Server" (http://www.dotnetjunkies.com/tutorial/a4ed5fd6-d385-4475-a357-27cf43a78205.dcik) and "SqlDependency—Proof of Concept" (http://www.dotnetjunkies.com/tutorial/52d515c3-4322-4cff-8aab-3e0b2dc4b4b9.dcik), Donny Mack enhanced Howard's code by refactoring some of the classes and procedures and explained the code in more detail.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish