using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Media.Imaging; namespace AIK.Service.IService { public interface IFileCacheService { /// /// 异步获取文件。优先从缓存中获取,若不存在或已过期则从网络下载。 /// /// 第三方文件地址 /// 自定义缓存键(可选) /// 缓存的文件数据 Task GetFileByteAsync(string fileUrl, string cacheKey = null, CancellationToken cancellationToken = default); /// /// 带进度的文件下载方法。优先从缓存中获取,若不存在或已过期则从网络下载。 /// /// /// /// /// /// Task<(bool success, string localFilePath)> DownloadFileWithProgressAsync(string fileUrl, string cacheKey, IProgress progress = null, CancellationToken cancellationToken = default); /// /// 清除所有过期的缓存文件。(bin文件默认无过期期限) /// Task ClearExpiredCacheAsync(); /// /// 强制清除所有缓存(内存和磁盘)。 /// Task ClearAllCacheAsync(); } }