public ImageCachingMiddleware( RequestDelegate next, IHostingEnvironment env, IImageCacheHelper cacheHelper, CachingOptions options) { _next = next; _options = options; _cacheHelper = cacheHelper; _cacheHelper.InitializeCache(_options); }
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)); }