예제 #1
0
        protected override void Setup(TimeSpan?expirationScanFrequency)
        {
            var loggerFactory = new LoggerFactory();

            _cts = new CancellationTokenSource();

            var cache = new FileSystemBundleCache(_cts.Token, null, loggerFactory, Clock,
                                                  Options.Create(new FileSystemBundleCacheOptions
            {
                FileProvider             = new PhysicalFileProvider(Environment.CurrentDirectory),
                EnableExpirationScanning = expirationScanFrequency.HasValue,
                ExpirationScanFrequency  = expirationScanFrequency ?? default(TimeSpan),
                AutoResetOnCreate        = true,
                BasePath = "Cache" + Interlocked.Increment(ref s_counter).ToString()
            }));

            _cache    = cache;
            _basePath = cache.PhysicalBasePath;
        }
예제 #2
0
        protected override void Setup(TimeSpan?expirationScanFrequency)
        {
            var loggerProvider = new ConsoleLoggerProvider((s, l) => l >= LogLevel.Warning, true);
            var loggerFactory  = new LoggerFactory(new[] { loggerProvider });

            var cache = new FileSystemBundleCache(CancellationToken.None, null, loggerFactory, Clock,
                                                  Options.Create(new FileSystemBundleCacheOptions
            {
                FileProvider             = new PhysicalFileProvider(Environment.CurrentDirectory),
                EnableExpirationScanning = expirationScanFrequency.HasValue,
                ExpirationScanFrequency  = expirationScanFrequency ?? default(TimeSpan),
                AutoResetOnCreate        = true,
                BasePath = "Cache" + Interlocked.Increment(ref counter).ToString()
            }),
                                                  Options.Create(new BundleGlobalOptions
            {
                EnableChangeDetection = true
            }));

            _cache    = cache;
            _basePath = cache.PhysicalBasePath;
        }