/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting /// unmanaged resources. /// </summary> /// <param name="disposing">True if it is a managed dispose, false otherwise.</param> /// <remarks> /// When called on a cache using <see cref="SystemMemoryCache.Default"/> as store, this /// method does nothing. In fact, it is not safe to dispose the default memory cache instance. /// </remarks> protected override void Dispose(bool disposing) { if (!disposing) { // Nothing to do, we can handle only managed Dispose calls. return; } if (_store != null && _store != SystemMemoryCache.Default) { _store.Dispose(); _store = null; } }
public void ReleaseCache(System.Runtime.Caching.MemoryCache cache) { if (cache != null) { cache.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { _memoryCache?.Dispose(); } }
public void Dispose() { cache?.Dispose(); }
public static void ClearCache() { _memCache.Dispose(); _memCache = new System.Runtime.Caching.MemoryCache("HopsCache"); EntryCount = 0; }
public void Dispose() { _cache.Dispose(); }