Caching

URL to Item Mapping Cache

By default url-to-item mapping  is enabled. Second level cache (generic database entity cache) and output cache can be enabled via configuration. The caches are invalidated when content is changed.

Enable output cache for any controller implementing ContentController<> and any page implementing ContentPage<>:

     <n2 xmlns="http://n2cms.com/schemas/configuration/v3">
           <host rootID="1" startPageID="2">
                <!-- output cache caches the rendered page and
                is invalidated when a page is published -->
                <outputCache enabled="true" duration="10"/>
           </host>
           <engine/>
           <database />
           <edit/>
     </n2>

To disable url-to-item mapping cache:

     <n2 xmlns="http://n2cms.com/schemas/configuration/v3">
           <host rootID="1" startPageID="2">
                <web>
                     <!-- Disable url caching will make the system
                     traverse children for each request  -->
                     <urls enableCaching="false" />
                </web>
           </host>
           <engine/>
           <database />
           <edit/>
     </n2>

Database Entity Cache

To enable second level cache (generic database entity cache):

     <n2 xmlns="http://n2cms.com/schemas/configuration/v3">
           <host rootID="1" startPageID="2"/>
           <engine/>
           <!-- Other cache providers are also available -->
           <database caching="true"
                cacheProviderClass="NHibernate.Caches.SysCache2.SysCacheProvider, NHibernate.Caches.SysCache2"/>
           <edit/>
     </n2>

NHibernate Caching

TODO