using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Media.Imaging; namespace AIK.Service.IService { public interface IImageCacheService { /// /// 异步获取图片。优先从缓存中获取,若不存在或已过期则从网络下载。 /// /// 第三方图片地址 /// 自定义缓存键(可选) /// 缓存的图片 Task GetImageAsync(string imageUrl, string cacheKey = null, CancellationToken cancellationToken = default); /// /// 异步获取图片。优先从缓存中获取,若不存在或已过期则从网络下载。 /// /// 第三方图片地址 /// 自定义缓存键(可选) /// 缓存的图片 Task GetImageByLocalPathAsync(string imageUrl, string cacheKey = null, CancellationToken cancellationToken = default); /// /// 返回本地存储的文件路径 /// /// /// /// /// 缓存的图片文件本地路径 Task GetImagePathAsync(string imageUrl, string cacheKey = null, CancellationToken cancellationToken = default); /// /// 清除所有过期的缓存文件。 /// Task ClearExpiredCacheAsync(); /// /// 强制清除所有缓存(内存和磁盘)。 /// Task ClearAllCacheAsync(); } }