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.

56 lines
2.0KB

  1. using HealthMonitor.Util.Models;
  2. namespace HealthMonitor.Core.Cache
  3. {
  4. public interface IDurableEntityManager
  5. {
  6. /// <summary>
  7. /// 判断实体类型是否支持持久化到缓存,若支持则返回缓存操作对象
  8. /// </summary>
  9. /// <param name="entityType"></param>
  10. /// <returns></returns>
  11. IEntityCacheHandler? GetCacheHandler(Type entityType);
  12. /// <summary>
  13. /// 获取缓存键
  14. /// </summary>
  15. /// <param name="entityType">实体类型</param>
  16. /// <param name="id"></param>
  17. /// <returns></returns>
  18. string CalcCacheKey(Type entityType, string id);
  19. /// <summary>
  20. /// 获取缓存键
  21. /// </summary>
  22. /// <param name="entityType">实体类型</param>
  23. /// <param name="conditions">查询条件</param>
  24. /// <returns></returns>
  25. string CalcCacheKey(Type entityType, GeneralParam conditions);
  26. /// <summary>
  27. /// 获取缓存键(历史表)
  28. /// </summary>
  29. /// <param name="entityType">实体类型</param>
  30. /// <param name="id"></param>
  31. /// <param name="imei">设备serialno</param>
  32. /// <param name="date">查询的历史日期</param>
  33. /// <returns></returns>
  34. string CalcHistoryCacheKey(Type entityType, string id, string imei, DateTime? date = null);
  35. /// <summary>
  36. /// 获取缓存键(历史表)
  37. /// </summary>
  38. /// <param name="entityType">实体类型</param>
  39. /// <param name="conditions">查询条件</param>
  40. /// <param name="imei">设备serialno</param>
  41. /// <param name="date">查询的历史日期</param>
  42. /// <returns></returns>
  43. string CalcHistoryCacheKey(Type entityType, GeneralParam conditions, string imei, DateTime? date = null);
  44. /// <summary>
  45. /// 清理所有缓存实体的失效(超时)映射关系
  46. /// </summary>
  47. void CleanUpEntitiesMapper();
  48. }
  49. }