MemoryCache.Dispose Method ()
Releases all resources that are used by the current instance of the MemoryCache class.
Assembly: System.Runtime.Caching (in System.Runtime.Caching.dll)
Each MemoryCache instance is bound to the AppDomainUnloaded event. However, during application-domain shutdown, if a memory-based cache has not been explicitly disposed, the cache instance will automatically call the method.
The disposed cache instance is shut down using the following steps:
The state of the cache is set to indicate that the cache is disposed. Any attempt to call public caching methods that change the state of the cache, such as methods that add, remove, or retrieve cache entries, might cause unexpected behavior. For example, if you call the Set method after the cache is disposed, a no-op error occurs. If you attempt to retrieve items from the cache, the Get method will always return null.
Performance counter information is no longer raised from the current cache instance.
All references to cached objects held by the current cache instance are released.
Any CacheEntryChangeMonitor instances that are currently monitoring entries in the cache are notified.
Callback objects that provide notification of changes for those monitors are called.
Available since 4.0