【问题标题】:Expiration of NHibernate syscacheNHibernate syscache 过期
【发布时间】:2012-10-26 14:21:59
【问题描述】:

NHibernate 的 syscache 过期如何工作?

如果我将过期时间设置为 10 分钟,并且每分钟添加一个实体,那么当前 10 分钟(应用程序启动后)结束时,是全部删除 10 个实体,还是只删除第一个?

是从缓存中完全删除所有数据,还是每个实体都有时间戳?

【问题讨论】:

  • 这是一个非常好的问题,我怀疑您设置的每个区域都会使其包含的所有实体都过期。文档并没有真正告诉您它是否是滑动缓存,docs.huihoo.com/hibernate/nhibernate-reference-1.2.0/…。我想你它确实这么说expiration = number of seconds to wait before expiring each item

标签: nhibernate syscache


【解决方案1】:

我刚刚查看了SysCache source code 内部,这行清楚地表明它是绝对过期的:

cache.Add(
    cacheKey,
    new DictionaryEntry(key, value),
    new CacheDependency(null, new[] {rootCacheKey}),
    DateTime.Now.Add(expiration),
    System.Web.Caching.Cache.NoSlidingExpiration,
    priority,
    null);

【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-26
      • 1970-01-01
      • 2011-04-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多