1

At what point does System.Runtime.Caching.MemoryCache invalidate expired entries? Is there some worker thread removing old entries from the internal store or are expired items removed when you access other methods on the cache?

The documentation does not state when and how the expired items are dealt with.

This question is about the inner workings of the class, not how to use the API, thus, no code example.

If I add a billion items to the cache with a short expiration time, then let the system sleep for a few hours, will the expired items still linger around untill I touch the cache, or will they be cleared out as time pass by?

[edit] This is apparently a duplicate of When Does Asp.Net Remove Expired Cache Items?

the related suggestions are better than the search feature here on SO

Community
  • 1
  • 1
Roger Johansson
  • 22,764
  • 18
  • 97
  • 193
  • By the looks of it, it uses a System.Threading.Timer in an internal class called `CacheExpires`, that is instantiated by the also internal `MemoryCacheStore` – rene Apr 14 '14 at 14:27

0 Answers0