|
- namespace HealthMonitor.Core.Cache
- {
- public interface IEntityCacheHandler
- {
- /// <summary>
- /// 获取缓存时间(单位秒)
- /// </summary>
- int DurableSecond { get; }
-
- /// <summary>
- /// 根据缓存键获取实体集
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- IEnumerable<object> GetEntitiesCache(string key);
-
- /// <summary>
- /// 根据缓存键更新实体
- /// </summary>
- /// <param name="key"></param>
- /// <param name="param">单实体,或者实体列表</param>
- /// <param name="isEnumerable">是否为实体列表</param>
- void SetEntityCache(string key, object param, bool isEnumerable = false);
-
- /// <summary>
- /// 清除指定缓存键的实体
- /// </summary>
- /// <param name="key"></param>
- void DeleteEntityCache(string key);
-
- /// <summary>
- /// 获取并移除指定实体主键映射的所有缓存键
- /// </summary>
- /// <param name="id"></param>
- IEnumerable<string> UnmapKeyFromEntity(object entity);
-
- /// <summary>
- /// 清理失效(超时)的映射关系
- /// </summary>
- void CleanUpExpiredMapper();
- }
- }
|