public void Initialize()
        {
            _releaseCallCount = 0;
            _releaseValues    = new List <int>();
            _releaser         = new ResourceReleaserImpl <int>(
                v =>
            {
                ++_releaseCallCount;
                _releaseValues.Add(v);
            });

            _onExclusivityChangedCallCount = 0;
            _isExclusive        = null;
            _entryStateObserver = new EntryStateObserverImpl <string>(
                (v, b) =>
            {
                ++_onExclusivityChangedCallCount;
                _isExclusive = b;
            });

            _cacheTrimStrategy = new CacheTrimStrategyImpl(v => _trimRatio);
            _valueDescriptor   = new ValueDescriptorImpl <int>(v => v);
            _params            = new MemoryCacheParams(
                CACHE_MAX_SIZE,
                CACHE_MAX_COUNT,
                CACHE_EVICTION_QUEUE_MAX_SIZE,
                CACHE_EVICTION_QUEUE_MAX_COUNT,
                CACHE_ENTRY_MAX_SIZE);

            _paramsSupplier        = new MockSupplier <MemoryCacheParams>(_params);
            _platformBitmapFactory = new MockPlatformBitmapFactory();
            _bitmap          = new SoftwareBitmap(BitmapPixelFormat.Rgba8, 50, 50);
            _bitmapReference = CloseableReference <SoftwareBitmap> .of(
                _bitmap, BITMAP_RESOURCE_RELEASER);

            _cache = new CountingMemoryCache <string, int>(
                _valueDescriptor,
                _cacheTrimStrategy,
                _paramsSupplier,
                _platformBitmapFactory,
                true);
        }
        /// <summary>
        /// Instantiates the <see cref="CountingMemoryCache{K, V}"/>.
        /// </summary>
        public CountingMemoryCache(
            IValueDescriptor <V> valueDescriptor,
            ICacheTrimStrategy cacheTrimStrategy,
            ISupplier <MemoryCacheParams> memoryCacheParamsSupplier,
            PlatformBitmapFactory platformBitmapFactory,
            bool isExternalCreatedBitmapLogEnabled)
        {
            _valueDescriptor           = valueDescriptor;
            _exclusiveEntries          = new CountingLruMap <K, Entry>(WrapValueDescriptor(valueDescriptor));
            _cachedEntries             = new CountingLruMap <K, Entry>(WrapValueDescriptor(valueDescriptor));
            _cacheTrimStrategy         = cacheTrimStrategy;
            _memoryCacheParamsSupplier = memoryCacheParamsSupplier;
            _memoryCacheParams         = _memoryCacheParamsSupplier.Get();
            _lastCacheParamsCheck      = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;

            if (isExternalCreatedBitmapLogEnabled)
            {
                platformBitmapFactory.SetCreationListener(
                    new BitmapCreationObserverImpl((b, o) => _otherEntries.Add(b, o)));
            }
        }