How to configure cache areas for syscache in nhibernate?

I tried using a cache configuration similar to this entry from the website:

<configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" requirePermission="false"/>
    <section name="syscache" type="NHibernate.Caches.SysCache.SysCacheSectionHandler, NHibernate.Caches.SysCache" requirePermission="false" />
</configSections>

<!-- NHibernate -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <!-- dialect, connection string, etc... -->

        <property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
        <property name="cache.use_second_level_cache">true</property>
    </session-factory>
</hibernate-configuration>

<!-- Caching -->
<syscache>
    <cache region="LongTerm" expiration="3600" priority="5" />
    <cache region="ShortTerm" expiration="900" priority="3" />
</syscache>

<-- ... -->

It seems that the schema file for my hibernate.cfg.xml does not like this. Should I use cache.region_prefix or something else? I want to use Syscache, btw.

+3
source share
1 answer

Neither the section configSectionsnor the syscachehibernate.cfg.xml file goes.

They are included in the App.config/ file Web.config.

+4
source

Source: https://habr.com/ru/post/1753915/


All Articles