Main Page

  Previous Section Next Section

Chapter 24. The System.Web.Caching Namespace

The System.Web.Caching namespace includes types used for ASP.NET data caching. The Cache class is the focal point of this namespace; it contains a collection of cached objects and allows you to set expiration policies and dependencies for each item in the cache. The CacheDependency class encapsulates a cache dependency and allows you to link the validity of a cache item to another item or a file on the web server. The CacheItemRemovedCallback delegate allows you to respond when an object is dropped from the cache. Both types work in conjunction with the Cache class. Together, they allow you to implement sophisticated data caching. Figure 24-1 shows the types in this namespace.

Figure 24-1. The System.Web.Caching namespace

ASP.NET also supports page caching, which stores entire compiled pages for automatic reuse. To configure settings for page caching, you must use the System.Web.HttpCachePolicy class.

      Previous Section Next Section