0

How works expiration of NHibernate's syscache?

If I set expiration to 10 minutes, and each minute I add an entity, when the first 10 minutes (after application start) end, are all 10 entities deleted, or only the first one?

Are all data removed from cache altogether, or is there a timestamp for each entity?

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
Francois
  • 10,730
  • 7
  • 47
  • 80
  • 1
    Now that is a very good question, I suspect each region you set up expires all entities it contains. The docs don't really tell you whether it is a sliding cache or not, http://docs.huihoo.com/hibernate/nhibernate-reference-1.2.0/caches.html . Mimd you it does say this `expiration = number of seconds to wait before expiring each item` – Rippo Oct 26 '12 at 15:27

2 Answers2

4

I've just looked inside SysCache source code and this line clearly states that it's absolute expiration:

cache.Add(
    cacheKey,
    new DictionaryEntry(key, value),
    new CacheDependency(null, new[] {rootCacheKey}),
    DateTime.Now.Add(expiration),
    System.Web.Caching.Cache.NoSlidingExpiration,
    priority,
    null);
Michael Logutov
  • 2,551
  • 4
  • 28
  • 32
0

Sliding expiration, as pointed out by Rippo.

http://docs.huihoo.com/hibernate/nhibernate-reference-1.2.0/caches.html

Francois
  • 10,730
  • 7
  • 47
  • 80