This post originated from an RSS feed registered with .NET Buzz
by Michael Mello.
Original Post: Warning: Page and Fragment Caching
Feed Title: melloblog
Feed URL: http://www.thauvin.net/errorpage.htm?aspxerrorpath=/Default.aspx
Feed Description: .NET and Everything After.
Caching in ASP.NET is a great feature that should be utilized when necessary. Unfortunately it can cause a lot of headaches as well - something I learned early on, and I thought I would share.
Watch your cache at all times
Page output caching will override fragment caching if the value is greater than that of the user control. For example, if you have a page that has output cache set for 150 seconds, and a user control (within the same page) that is set for 100 seconds; there will be some undesired results. The user control will remain in the cache for the duration of the page, which in this case is 150 seconds, instead of the user control value of 100. On the other hand, if the user control was set to cache every 150 seconds, and the page was set for 100, then your user control will remain cached, even when the page is regenerated. (Providing the desired results)
I guess the lesson here is to watch your cache carefully, and be fully aware of when and how you implement ASP.NET caching features.