【问题标题】:NHibernate: second level cache expirationNHibernate:二级缓存过期
【发布时间】:2011-10-18 02:43:26
【问题描述】:

我们正在使用 Nhibernate 和二级缓存(非严格读写)。使用 NH Profiler 分析应用程序时,我可以看到数据被请求一次。但是如果网络应用程序空闲,几分钟后,在第一次请求时,再次请求数据......缓存是否有一些过期日期/超时?如何防止缓存被清除?

【问题讨论】:

    标签: c# asp.net nhibernate second-level-cache


    【解决方案1】:

    假设您使用的是 SysCache:

    <configuration>
      <configSections>
        <section name="syscache" type="NHibernate.Caches.SysCache.SysCacheSectionHandler,NHibernate.Caches.SysCache" />
      </configSections>
    
      <syscache>
        <cache region="foo" expiration="500" priority="4" />
        <cache region="bar" expiration="300" priority="3" />
      </syscache>
    </configuration>
    

    【讨论】:

    • 它工作正常,谢谢。还有一个问题:你知道默认的过期延迟吗?
    • 我相信默认值为 300(5 分钟)。在 NHibernate in Action 中阅读此内容。
    • 如何通过fluent配置设置这个过期超时时间?
    猜你喜欢
    • 2011-09-02
    • 1970-01-01
    • 2011-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-26
    • 2011-06-19
    • 1970-01-01
    相关资源
    最近更新 更多