-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
NHibernate 4.x Cookbook - Second Edition
By :
Caching is used frequently; rarely updated data can greatly improve the performance of websites and other high traffic applications. In this recipe, we'll configure NHibernate's cache, just as we would for a typical public facing website.
Complete the Getting Ready instructions at the beginning of Chapter 4, Queries.
Add a reference to NHibernate.Caches.SysCache using NuGet Package manager console.
Open or create a new App.config file in the project.
In the configSections element, declare a section for the cache configuration:
<section name="syscache" type="NHibernate.Caches.SysCache.SysCacheSectionHandler, NHibernate.Caches.SysCache" />
Add the syscache section:
<syscache> <cache region="hourly" expiration="60" priority="3" /> </syscache>
Add a new folder named Caching to the QueryRecipes project.
Add a new XML file named hibernate.cfg.xml to the folder. Set its Copy to Output directory property to Copy always:
<?xml...