c# - 我如何在 nhibernate 中为 syscache 配置缓存区域?

标签 c# nhibernate syscache

我尝试使用来自网站的这篇文章的缓存配置:

<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>

<-- ... -->

不过,我的 hibernate.cfg.xml 的模式文件似乎不喜欢这样。我应该使用 cache.region_prefix 还是什么?顺便说一下,我想使用 Syscache。

最佳答案

configSectionssyscache 部分都不在您的 hibernate.cfg.xml 文件中。

它们进入 App.config/Web.config 文件。

关于c# - 我如何在 nhibernate 中为 syscache 配置缓存区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3214825/

相关文章:

c# - 优化新闻获取

c# - 如何将 mp3 文件分割成几个可单独播放的部分?

带有外部更新的 NHibernate 二级缓存

performance - 为什么NHibernate会一一删除引用的对象,而不是使用外键?

nhibernate L2缓存: configure by code

c# - 是否可以编写类似 - ()() 的语法?

c# - 目录列表递归

c# - 哪一个更适合使用 linq 使我的表的最后一行进入休眠状态?

SQL 联合到 NHibernate 标准