You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 line
1.3KB

  1. namespace HealthMonitor.Core.Cache
  2. {
  3. public interface IEntityCacheHandler
  4. {
  5. /// <summary>
  6. /// 获取缓存时间(单位秒)
  7. /// </summary>
  8. int DurableSecond { get; }
  9. /// <summary>
  10. /// 根据缓存键获取实体集
  11. /// </summary>
  12. /// <param name="key"></param>
  13. /// <returns></returns>
  14. IEnumerable<object>? GetEntitiesCache(string key);
  15. /// <summary>
  16. /// 根据缓存键更新实体
  17. /// </summary>
  18. /// <param name="key"></param>
  19. /// <param name="param">单实体,或者实体列表</param>
  20. /// <param name="isEnumerable">是否为实体列表</param>
  21. void SetEntityCache(string key, object param, bool isEnumerable = false);
  22. /// <summary>
  23. /// 清除指定缓存键的实体
  24. /// </summary>
  25. /// <param name="key"></param>
  26. void DeleteEntityCache(string key);
  27. /// <summary>
  28. /// 获取并移除指定实体主键映射的所有缓存键
  29. /// </summary>
  30. /// <param name="id"></param>
  31. IEnumerable<string>? UnmapKeyFromEntity(object entity);
  32. /// <summary>
  33. /// 清理失效(超时)的映射关系
  34. /// </summary>
  35. void CleanUpExpiredMapper();
  36. }
  37. }