开发者

What is the precision of the cache expiration timeout in ASP.NET?

开发者 https://www.devze.com 2023-03-10 10:10 出处:网络
In my application I\'m using absolute expiration for a cache entry: HttpContext.Cache .Insert (cacheKey, true, null, DateTime.UtcNow.AddMinutes (3), TimeSpan.Zero,

In my application I'm using absolute expiration for a cache entry:

HttpContext.Cache
.Insert (cacheKey, true, null, DateTime.UtcNow.AddMinutes (3), TimeSpan.Zero,
         CacheItemPriority.Default, SomeCallbackFunction);

Everything is working more or less fine except that the expiration does not always happen precisely after 3 minutes but often about 20 seconds too late. I've been wondering, is any kind of precision guaranteed for cache entries? Is it something that can be configured in IIS or elsewhere? Anything else that can influence the precision?

I'm running 2008 R2 with IIS 7.5 (not the development server).

开发者_StackOverflow社区

UPDATE: Linking to another question where a good answer has been given: Changing frequency of ASP.NET cache item expiration?


Look at this related question.

Clearing expired items runs on a timer with a frequency of 20 seconds under some conditions, which probably explains what you're observing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号