using System.Collections.Generic; using System.Threading.Tasks; namespace LiveForum.IService.Others { /// /// 缓存清除服务接口 /// public interface ICacheClearService { /// /// 清除所有缓存(支持模式匹配,如 cache:api:Config:*) /// /// 缓存Key模式,支持通配符(*),为空则清除所有cache:api:开头的缓存 /// 是否清除成功 Task ClearAllCacheAsync(string pattern = null); /// /// 清除指定Controller的所有缓存 /// /// Controller名称(不含Controller后缀,如 "Config") /// 是否清除成功 Task ClearCacheByControllerAsync(string controller); /// /// 清除指定Action的缓存 /// /// Controller名称(不含Controller后缀,如 "Config") /// Action名称(如 "GetAppConfig") /// 是否清除成功 Task ClearCacheByActionAsync(string controller, string action); /// /// 清除指定Key的缓存(精确匹配) /// /// 缓存Key /// 是否清除成功 Task ClearCacheByKeyAsync(string cacheKey); /// /// 获取匹配模式的缓存Key列表(用于查询) /// /// 缓存Key模式,支持通配符(*) /// 匹配的缓存Key列表 Task> GetCacheKeysAsync(string pattern); } }