Does cache absolute expiration guarantee that the cache is eliminated at the exact time?
I am using the HttpRuntime cache to store lists of objects and in our current project it was specified that the objects should be cached until midnight, so I am using DateTime.Today.AddHours(24) in order to set the absolute expiration date to midnight.
For example, if today is May 26th, the absolute ex开发者_JS百科piration time will be set to May 27th 0:00.
But somehow, when I change the clock of my computer, the objects are still in cache. Should I wait a little (the CacheItemPriority is set to Normal)? Am I forgetting something?
Thank you
It does not guarantee that the cache will be expired at the exact time. There are conditions such as the system running low on memory that would cause the cache to expire. So don't assume that what you've put in the cache will be there later - always check first.
ASP.NET can remove data from the cache for one of these reasons:
Because memory on the server is low, a process known as scavenging.
Because the item in the cache has
expired.Because the item's dependency
changes.To help you manage cached items,
ASP.NET can notify your
application when items are removed from the cache.
精彩评论