Distributed Cache for ASP.NET Output Caching
NCache provides an extremely fast and reliable Output Caching feature for ASP.NET applications running in the web farm environment.
Note
This feature is also available in NCache Professional.
ASP.NET Output Caching system caches the different versions of pages’ content depending on various parameters like query string parameters and browser type. In ASP.NET 4.0, an extensibility point has been added that helps developers use any other caching system of their choice other than ASP.NET’s cache. NCache’s Output Cache Provider is derived from System.Client.Output
CacheProvider
to benefit from ASP.NET 4.0 Output Caching extensibility.
Since the enterprise-level applications are typically hosted in multi-server web farms, InProc Output Caching does not provide much benefit as compared to having a distributed OutProc cache. Using this extensibility feature of ASP.NET 4.0, NCache now has its own ASP.NET Output Caching Provider.
Distributed in Nature: NCache Output Cache Provider is OutProc as well as distributed in nature.
Availability: Using NCache’s Output Cache Provider, the content of different ASP.NET pages can be cached on multiple servers instead of caching them in each of the ASP.NET worker processes separately. This allows each server in a web farm to share a single distributed cache.
Reliability and Fault Tolerance: Unlike ASP.NET’s Output Cache, content cached in NCache’s Output Cache Provider is not lost when a worker process crashes or when the IIS application pool is recycled.
Scalability: NCache Output Cache Provider is not restricted to the memory available on each server as the cache cluster can grow dynamically.
No Application Code Change: These hooks can be implemented, configured, and, deployed without making any changes to the application’s code. All that is required to configure and deploy is to modify the application’s Web.config file.
Output Cache with Custom Hooks: NCache Output Cache Provider gives extra control by allowing the users to hook their custom code to modify the cache item’s attributes before it is cached. Since the ASP.NET Output Caching system does not give any out-of-the-box mechanism to specify cache dependencies, these hooks can be used to add cached items with the dependencies information. These dependencies can be key, file, or database dependencies.
As in most enterprise applications, a page or control’s output usually depends on some data in the database. In such applications, the user would want to keep an output of a page or control cached until the data gets changed in the database on which this page’s content depends. Similarly, the user may want to change the expiration time for certain pages at runtime overriding the default expiration given in configuration settings. All this can be achieved by writing a custom hook by implementing the IOutPutCacheHook
interface. These hooks can be implemented, configured, and deployed without making any changes to the application's code. All that is required to configure and deploy is to modify the application’s Web.config file.
In This Section
ASP.NET Output Cache Provider Overview
Explains how to configure ASP.NET Output Cache in NCache applications.
ASP.NET Output Cache with Custom Hooks
Explains how to use ASP.NET Output Cache with Custom Hooks in your applications.