Geeks With Blogs

News Awarded Microsoft MVP C#.NET - 2007, 2008 and 2009


I am born in Bangladesh and currently live in Melbourne, Australia. I am a Microsoft Certified Application Developer MCAD Chartered Member (C# .Net)and born in Bangladesh.
I am founder and Chief Executive Officer of
Simplexhub, a highly experienced software development company based in Melbourne Australia and Dhaka, Bangladesh. Co-founder and core developer of Pageflakes www.pageflakes.com.
Simplexhub, is on its mission to build a smart virtual community in Bangladesh and recently launched beta realestatebazaar.com.bd an ASP.NET MVC application written in C#.NET.


Some of My Articles
Flexible and Plugin based .Net Application..
Mass Emailing Functionality with C#, .NET 2.0, and Microsoft® SQL Server 2005 Service Broker'
Write your own Code Generator or Template Engine in .NET
Shahed Khan blog

Asp.net 2.0 supports database cache dependencies. So changes in the Tables data can be notified and cache can expire. This is a very handy feature.

Here is how we can do this

<@ outputcache duration= "7200" varybyparam="CustomerID" sqldependency="DatabaseName:Customer" %>

this means the cached page expires in 2 hours but also depends on database table. Any changes on the database table data will also invalidate the cache.

Borrowed the following code from this link: Link to Improved Caching in ASP.NET 2.0

<%@ OutputCache SqlDependency="Pubs:Titles" Duration="6000" VaryByParam="none" %>

<html>
<head runat="server">

<title>Output Cache Titles</title>

</head>

<body>

<form id="form1" runat="server"> <%= DateTime.Now %>

<asp:GridView ID="grdTitles" DataSourceID="SqlDataSource1" Runat="Server" />

<asp:SqlDataSource ID="SqlDataSource1" SelectCommand="Select * FROM Titles" ConnectionString="<%$ ConnectionStrings:mySqlServer %>" Runat="Server" />

</form>

</body>

</html>

Posted on Thursday, November 16, 2006 6:24 AM | Back to top


Comments on this post: Cache Invalidation for Dynamic pages in Asp.net 2.0

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Shahed Khan | Powered by: GeeksWithBlogs.net