Exemple #1
0
        public IDataSource CreateDataSource()
        {
            LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(_maxCacheSize);
            SimpleCache simpleCache = new SimpleCache(new Java.IO.File(_context.CacheDir, "media"), evictor);

            return(new CacheDataSource(
                       simpleCache,
                       _defaultDatasourceFactory.CreateDataSource(),
                       new FileDataSource(),
                       new CacheDataSink(simpleCache, _maxFileSize),
                       CacheDataSource.FlagBlockOnCache | CacheDataSource.FlagIgnoreCacheOnError,
                       null));
        }
Exemple #2
0
            public IDataSource CreateDataSource()
            {
                var cacheDirectory = new Java.IO.File(context.CacheDir, "wtf");

                if (cacheDirectory.Exists())
                {
                    cacheDirectory.Delete();
                }
                var evictor = new LeastRecentlyUsedCacheEvictor(maxCacheSize);
                var cache   = new SimpleCache(cacheDirectory, evictor);

                return(new CacheDataSource(cache, defaultDatasourceFactory.CreateDataSource(),
                                           new FileDataSource(), new CacheDataSink(cache, maxFileSize),
                                           CacheDataSource.FlagBlockOnCache | CacheDataSource.FlagIgnoreCacheOnError, null));
            }