ASP.NET's output caching system caches the different versions of pages’ content depending on the various parameters e.g query string parameters, browser type etc. 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.Web.Caching.Output CacheProvider to get benefited from ASP.NET 4.0 output caching extensibility.
Since the enterprise level applications are typically hosted in multi-sever web farms, InProc output caching does not provide much benefit as compared to have a distributed OutProc cache. Using this extensibility feature of ASP.NET 4.0, NCache now has its own ASP.NET output caching provider.
-
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 dependies As in most of the 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 IOutPutCacheHook interface. These hooks can be implemented, configured and deployed without making any changes to the applications code. All that is required to configure and deploy is to modify the application’s web.config file.
See Also