Extending ASP.NET Output Caching

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
One of the most sure-fire ways to improve a web applications performance is to employ caching. Caching takes some expensive operation and stores its results in a quickly accessible location. Since its inception, ASP.NET has offered two flavors of caching:


  • Output Caching - caches the entire rendered markup of an ASP.NET page or User Control for a specified duration.
  • Data Caching - a API for caching objects. Using the data cache you can write code to add, remove, and retrieve items from the cache.
Until recently, the underlying functionality of these two caching mechanisms was fixed - both cached data in the web servers memory. This has its drawbacks. In some cases, developers may want to save output cache content to disk. When using the data cache you may want to cache items to the cloud or to a distributed caching architecture like memcached. The good news is that with ASP.NET 4 and the .NET Framework 4, the output caching and data caching options are now much more extensible. Both caching features are now based upon the provider model, meaning that you can create your own output cache and data cache providers (or download and use a third-party or open source provider) and plug them into a new or existing ASP.NET 4 application.

This article focuses on extending the output caching feature. Well walk through how to create a custom output cache provider that caches a page or User Controls rendered output to disk (as opposed to memory) and then see how to plug the provider into an ASP.NET application. A complete working example, available in both VB and C#, is available for download at the end of this article. Read on to learn more!
Read More >



More...
 
Back
Top