private static void OnProxyDisposed(CacheItemProxy cacheItemProxy) { ReferenceCountedObjectWrapper <CacheItem> wrapper = cacheItemProxy.Wrapper; if (!wrapper.IsReferenceCountAboveZero()) { lock (_syncLock) { //The count could have gone back up if (wrapper.IsReferenceCountAboveZero()) { return; } CacheItem cacheItem = wrapper.Item; _cache.Remove(cacheItem.Key); cacheItem.Dispose(); if (_cache.Count == 0) { Trace.WriteLine("The composed lut cache is empty.", "LUT"); } } } }
private void DisposeCacheItemProxy() { if (_cacheItemProxy != null) { _cacheItemProxy.Dispose(); _cacheItemProxy = null; } }
private static void OnProxyDisposed(CacheItemProxy cacheItemProxy) { ReferenceCountedObjectWrapper<CacheItem> wrapper = cacheItemProxy.Wrapper; if (!wrapper.IsReferenceCountAboveZero()) { lock (_syncLock) { //The count could have gone back up if (wrapper.IsReferenceCountAboveZero()) return; CacheItem cacheItem = wrapper.Item; _cache.Remove(cacheItem.Key); cacheItem.Dispose(); if (_cache.Count == 0) Trace.WriteLine("The composed lut cache is empty.", "LUT"); } } }