Example #1
0
        public async Task TestDoesntAlwaysHaveKeySync()
        {
            await _bufferedDiskCache.Put(_cacheKey, _encodedImage);

            _fileCache = _fileCacheFactory.Get(DiskCacheConfig.NewBuilder().Build());
            _stagingArea.ClearAll();
            _bufferedDiskCache = new BufferedDiskCache(
                _fileCache,
                _byteBufferFactory,
                _pooledByteStreams,
                _readPriorityExecutor,
                _writePriorityExecutor,
                _imageCacheStatsTracker);
            Assert.IsFalse(_bufferedDiskCache.ContainsSync(_cacheKey));
            Assert.IsTrue(await _bufferedDiskCache.Contains(_cacheKey));
        }
Example #2
0
 public void TestClearAll()
 {
     _stagingArea.Put(new SimpleCacheKey("second"), _secondEncodedImage);
     _stagingArea.ClearAll();
     Assert.AreEqual(2, _closeableReference.GetUnderlyingReferenceTestOnly().GetRefCountTestOnly());
     Assert.AreEqual(2, _closeableReference.GetUnderlyingReferenceTestOnly().GetRefCountTestOnly());
     Assert.IsFalse(_stagingArea.Remove(_cacheKey));
 }