// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) James South. // Licensed under the Apache License, Version 2.0. // // // Defines properties and methods for allowing caching of images to different sources. // // -------------------------------------------------------------------------------------------------------------------- namespace ImageProcessor.Web.Caching { using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using System.Web; /// /// Defines properties and methods for allowing caching of images to different sources. /// public interface IImageCache { /// /// Gets or sets any additional settings required by the cache. /// Dictionary Settings { get; set; } /// /// Gets the path to the cached image. /// string CachedPath { get; } /// /// Gets the maximum number of days to store the image. /// int MaxDays { get; } /// /// Gets a value indicating whether the image is new or updated in an asynchronous manner. /// /// /// The asynchronous returning the value. /// Task IsNewOrUpdatedAsync(); /// /// Adds the image to the cache in an asynchronous manner. /// /// /// The stream containing the image data. /// /// /// The content type of the image. /// /// /// The representing an asynchronous operation. /// Task AddImageToCacheAsync(Stream stream, string contentType); /// /// Trims the cache of any expired items in an asynchronous manner. /// /// /// The asynchronous representing an asynchronous operation. /// Task TrimCacheAsync(); /// /// Gets a string identifying the cached file name. /// /// /// The asynchronous returning the value. /// Task CreateCachedFileName(); /// /// Rewrites the path to point to the cached image. /// /// /// The encapsulating all information about the request. /// void RewritePath(HttpContext context); } }