平安校园
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.

ISimpleCacheHashService.cs 1.8 KiB

4 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. 
  2. //
  3. namespace SafeCampus.Cache;
  4. /// <summary>
  5. /// 缓存服务
  6. /// </summary>
  7. public partial interface ISimpleCacheService
  8. {
  9. /// <summary>
  10. /// 添加一条数据到HashMap
  11. /// </summary>
  12. /// <typeparam name="T"></typeparam>
  13. /// <param name="key">键</param>
  14. /// <param name="hashKey">hash列表里的Key</param>
  15. /// <param name="value">值</param>
  16. void HashAdd<T>(string key, string hashKey, T value);
  17. /// <summary>
  18. /// 添加多条数据到HashMap
  19. /// </summary>
  20. /// <typeparam name="T"></typeparam>
  21. /// <param name="key">键</param>
  22. /// <param name="dic">键值对字典</param>
  23. /// <returns></returns>
  24. bool HashSet<T>(string key, Dictionary<string, T> dic);
  25. /// <summary>
  26. /// 从HashMap中删除数据
  27. /// </summary>
  28. /// <typeparam name="T"></typeparam>
  29. /// <param name="key">键</param>
  30. /// <param name="fields">hash键列表</param>
  31. /// <returns>执行结果</returns>
  32. int HashDel<T>(string key, params string[] fields);
  33. /// <summary>
  34. /// 根据键获取hash列表中的值
  35. /// </summary>
  36. /// <typeparam name="T"></typeparam>
  37. /// <param name="key">键</param>
  38. /// <param name="fields">hash键列表</param>
  39. /// <returns>数据列表</returns>
  40. List<T> HashGet<T>(string key, params string[] fields);
  41. /// <summary>
  42. /// 根据键获取hash列表中的值
  43. /// </summary>
  44. /// <typeparam name="T"></typeparam>
  45. /// <param name="key">键</param>
  46. /// <param name="field">hash键</param>
  47. /// <returns></returns>
  48. T HashGetOne<T>(string key, string field);
  49. /// <summary>
  50. /// 获取所有键值对
  51. /// </summary>
  52. /// <typeparam name="T"></typeparam>
  53. /// <param name="key">键</param>
  54. /// <returns>数据字典</returns>
  55. IDictionary<string, T> HashGetAll<T>(string key);
  56. }