Orchard 1.6 has upgraded to NHibernate 3.3 and now includes a SysCache Module that is a 2nd level cache provider for NHibernate. By enabling SysCache you will activate both an entity cache and query cache that can be shared across all your website requests ( NHibernate Sessions ) and theoretically increase performance by reducing database requests on your Orchard Website.

NHibernate SysCache2 2nd-Level Caching

Second-level caching in NHibernate has been around for awhile, but Orchard Websites weren't able to take advantage of it until recently when Orchard 1.6 was upgraded to NHibernate 3. There are numerous second-level cache providers for NHibernate, but SysCache2 uses ASP.NET Caching which makes it an obvious choice for Orchard CMS.

The beauty of second-level caching in NHibernate is that it works at the SessionFactory Level and provides caching across all active NHibernate Sessions. In Orchard CMS a new NHibernate Session is created for each HTTP Request to the Orchard Website. First-level caching is done for each Session, but the cache is destroyed when the Session is destroyed. Second-level caching remains active and is available across all NHibernate Sessions and theoretically should give you a nice performance boost across the Orchard website by reducing NHibernate requests to the database.

The SysCache Module comes with Orchard 1.6 and all you have to do is enable it.

NHibernate SysCache2 Second-Level Cache Provider for Orchard CMS

If you look at the source code for the SysCache Orchard CMS Module, you will see just how easy it is to configure and enable a second-level cache provider for NHibernate. This is the main code for the SysCache Orchard Module:


public class SysCacheDatabaseCacheConfiguration:
                                  IDatabaseCacheConfiguration {
    private readonly ShellSettings _shellSettings;

    public SysCacheDatabaseCacheConfiguration
                                (ShellSettings shellSettings) {
        _shellSettings = shellSettings;

    public void Configure(ICacheConfigurationProperties cache) {
        cache.UseQueryCache = true;
        cache.RegionsPrefix = _shellSettings.Name;


As you can see, there isn't much code to enabling second-level caching in NHibernate.


Your mileage will vary as to how much SysCache will improve the performance of Orchard CMS by reducing activity to the database, but you can enable the module to add second-level caching to NHibernate and check out the results with Mini Profiler. You must be on Orchard 1.6, which uses NHibernate 3.x, in order to use the SysCache Orchard Module ( aka SysCache2 ).

If you're interested, I am an Orchard CMS Developer for Hire.