| | |
| | | namespace HStation.Service |
| | | { |
| | | /// <summary> |
| | | /// 消火栓系数 |
| | | ///</summary> |
| | | internal class AssetsHydrantCoefficientCacheHelper |
| | | /// AssetsHydrantFactor |
| | | /// 缓存辅助类 |
| | | /// </summary> |
| | | internal class AssetsHydrantFactorCacheHelper |
| | | { |
| | | |
| | | private const string _contentKey = "AssetsHydrantCoefficientList"; |
| | | private const string _contentKey = "AssetsHydrantFactorList"; |
| | | |
| | | internal static string GetCacheKey() |
| | | { |
| | | return CacheHelper.GetCacheKey(_contentKey); |
| | | } |
| | | internal static string GetCacheKey() |
| | | { |
| | | return CacheHelper.GetCacheKey(_contentKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置缓存 |
| | | /// </summary> |
| | | public static void Set(List<Model.AssetsHydrantCoefficient> list, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); |
| | | } |
| | | /// <summary> |
| | | /// 设置缓存 |
| | | /// </summary> |
| | | public static void Set(List<Model.AssetsHydrantFactor> list, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取缓存 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<Model.AssetsHydrantCoefficient> Get() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.Get<List<Model.AssetsHydrantCoefficient>>(cacheKey); |
| | | } |
| | | /// <summary> |
| | | /// 获取缓存 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<Model.AssetsHydrantFactor> Get() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.Get<List<Model.AssetsHydrantFactor>>(cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设置缓存 |
| | | /// </summary> |
| | | public static List<Model.AssetsHydrantCoefficient> GetSet(Func<List<Model.AssetsHydrantCoefficient>> func, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); |
| | | } |
| | | /// <summary> |
| | | /// 获取设置缓存 |
| | | /// </summary> |
| | | public static List<Model.AssetsHydrantFactor> GetSet(Func<List<Model.AssetsHydrantFactor>> func, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除缓存 |
| | | /// </summary> |
| | | public static void Remove() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheHelper.Remove(cacheKey); |
| | | } |
| | | /// <summary> |
| | | /// 移除缓存 |
| | | /// </summary> |
| | | public static void Remove() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheHelper.Remove(cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发布 |
| | | /// </summary> |
| | | public static void Publish(string key) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheWipeRelationHelper.Set(key, cacheKey); |
| | | } |
| | | /// <summary> |
| | | /// 发布 |
| | | /// </summary> |
| | | public static void Publish(string key) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheWipeRelationHelper.Set(key, cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 触发 |
| | | /// </summary> |
| | | public static void Trigger() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheWipeRelationHelper.Trigger(cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 触发 |
| | | /// </summary> |
| | | public static void Trigger() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheWipeRelationHelper.Trigger(cacheKey); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |