public SlidingCacheManager(IImageManager imageManager, int index, CacheFactory.CacheProgressCallback cacheCallback = null)
        {
            _imageManager  = imageManager;
            _cacheCallback = cacheCallback;
            _currentIndex  = index;

            _cacheCount     = _imageManager.Count < CACHE_LIMIT ? _imageManager.Count : CACHE_LIMIT;
            _cache          = new ConcurrentDictionary <int, CacheItem>();
            _fillAheadStack = new ConcurrentStack <int>();

            RunPrepareFillAheadPopulation();
        }
        public SlidingCacheManager(IImageManager imageManager, int index, CacheFactory.CacheProgressCallback cacheCallback = null)
        {
            _imageManager = imageManager;
            _cacheCallback = cacheCallback;
            _currentIndex = index;

            _cacheCount  = _imageManager.Count < CACHE_LIMIT ? _imageManager.Count : CACHE_LIMIT;
            _cache = new ConcurrentDictionary<int, CacheItem>();
            _fillAheadStack = new ConcurrentStack<int>();

            RunPrepareFillAheadPopulation();
        }
Exemple #3
0
        public FullCacheManager(IImageManager imageManager, int index, CacheFactory.CacheProgressCallback cacheCallback = null)
        {
            _imageManager  = imageManager;
            _cache         = new Dictionary <int, CacheItem>();
            _currentIndex  = index;
            _cacheCallback = cacheCallback;

            if ((_imageManager != null) && (_imageManager.Count > 0))
            {
                _fillAheadLookup = new BlockingCollection <int>(_imageManager.Count);

                // Start filling the cache on a separate thread
                _fillAheadCancellationTokenSource = new CancellationTokenSource();
                Task.Run(() => FillAheadCache(), _fillAheadCancellationTokenSource.Token);
            }
        }
 public NullCacheManager(IImageManager imageManager, int index, CacheFactory.CacheProgressCallback cacheCallback = null)
 {
     _cacheCallback = cacheCallback;
     _currentIndex = index;
     _imageManager = imageManager;
 }
Exemple #5
0
 public NullCacheManager(IImageManager imageManager, int index, CacheFactory.CacheProgressCallback cacheCallback = null)
 {
     _cacheCallback = cacheCallback;
     _currentIndex  = index;
     _imageManager  = imageManager;
 }