コード例 #1
0
 public ImageCachingMiddleware(
     RequestDelegate next,
     IHostingEnvironment env,
     IImageCacheHelper cacheHelper,
     CachingOptions options)
 {
     _next        = next;
     _options     = options;
     _cacheHelper = cacheHelper;
     _cacheHelper.InitializeCache(_options);
 }
コード例 #2
0
        public void InitializeCache(CachingOptions options)
        {
            _cachingOptions = options;
            CacheFolder     = Path.Combine(_env.WebRootPath, _cachingOptions.CacheDirectory);

            if (Directory.Exists(CacheFolder) == false)
            {
                Directory.CreateDirectory(CacheFolder);
            }

            RefreshCacheInvalidationPeriod();
        }
 public static IApplicationBuilder UseImageCachingMiddleware(this IApplicationBuilder builder, CachingOptions options)
 {
     return(builder.UseMiddleware <ImageCachingMiddleware>(options));
 }