10 Oktober 2008 23:26I am adding three strings to the cache with timeout values of five minutes. From an API point of view they appear to be correctly timing out i.e. Cache.Get(key) returns null after 5 minutes.
What I don’t understand is why my cache size, as reported by “show cachestats”, keeps growing each time these three cache values expire and I re-add them to the cache.
E.g. when the three strings are added to an empty cache, cachestats reports Total Items = 3 and Size = 34,476 bytes.
After the three strings expire, I add them back to the cache. Now cachestats reports Total Items = 6 and Size = 68,789.
Subsequent tries keep growing although not as fast.
When cache items expire why aren’t the Cache Size and Items decremented?
30 Oktober 2008 10:39
We do not evict the items as they expire because it will effect the performace instead we mark them as expired. The expired items are evicted from the cache after the cache memory reaches configured HMW (high-water-mark).So this is the expected behaviour for now.
31 Oktober 2008 18:05Moderator
To explain some of our eviction algorithms,
* Soft Eviction - we run periodic soft eviction that purges expired objects
* Hard Eviction - when we run close to the High Water Mark threshold, we evict expired objects and other objects based on LRU until we release enough memory
* Extreme Memory pressure - when the memory on the whole machine reaches close to 95% of the physical memory, we start hard eviction to relieve pressure.