ASP.NET version 2.0 retains all of the caching functionality of ASP.NET version 1.1, but adds new features and enhances existing features. New features include cache profiles, custom cache dependencies, a SQL cache dependency, and creating dynamic content in cached pages (post-cache substitution). Feature enhancements include a more powerful partial-page (control) caching model, enhanced cache configuration, and improvements to the output cache directive.
New Cache Features
Cache Profiles
Cache profiles allow you to create cache settings in an application's Web.config file and then reference those settings on individual pages. This allows you to apply cache settings to many pages at once. For example, you can define a cache profile named DailyUpdate that sets a page's cache duration to one day. You can then configure individual pages to use the DailyUpdate cache profile, and the cache duration of those pages will be one day. If you change the DailyUpdate cache profile to not use caching, the pages will stop being cached. For more information see Cache Configuration in ASP.NET.
Custom Cache Dependencies
In ASP.NET 2.0 you can create your own custom cache dependency based on application-specific conditions. To create a custom cache dependency, you create a class that inherits from
SqlCacheDependency
ASP.NET 2.0 introduces the
Post-Cache Substitution
ASP.NET 2.0 now supports post-cache substitution, which allows you to configure a section in a page as non-cacheable. Therefore, although the page is cached, parts of it will be re-processed when the page is requested again. For example, you can create a cached page with mostly static content but that displays the user's name in a
Caching Enhancements
Control Caching
In ASP.NET 1.1, you configure user control caching declaratively by setting parameters in the
Cache Configuration Enhancements
In addition to cache profiles, ASP.NET 2.0 introduces new cache configuration settings that you can specify in an application's Web.config file. These settings allow more control over the cache, such as how much memory is used and cache scavenging behavior. For more information see Cache Configuration in ASP.NET.
Output Cache Directive Improvements
ASP.NET 2.0 includes new