| | |
| | | namespace HStation.Service |
| | | { |
| | | /// <summary> |
| | | /// PumpType |
| | | /// AssetsPumpType |
| | | /// 缓存辅助类 |
| | | /// </summary> |
| | | internal class ManufacturerMappingCacheHelper |
| | | internal class AssetsManufacturerMappingCacheHelper |
| | | { |
| | | private const string _contentKey = "ManufacturerMapping"; |
| | | private const string _contentKey = "AssetsManufacturerMapping"; |
| | | |
| | | internal static string GetCacheKey() |
| | | { |
| | |
| | | /// <summary> |
| | | /// 设置缓存 |
| | | /// </summary> |
| | | public static void Set(List<Model.ManufacturerMapping> list, int Minites = 30, int RandomSeconds = 0) |
| | | public static void Set(List<Model.AssetsManufacturerMapping> list, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); |
| | |
| | | /// 获取缓存 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<Model.ManufacturerMapping> Get() |
| | | public static List<Model.AssetsManufacturerMapping> Get() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.Get<List<Model.ManufacturerMapping>>(cacheKey); |
| | | return MemoryCacheHelper.Get<List<Model.AssetsManufacturerMapping>>(cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设置缓存 |
| | | /// </summary> |
| | | public static List<Model.ManufacturerMapping> GetSet(Func<List<Model.ManufacturerMapping>> func, int Minites = 30, int RandomSeconds = 0) |
| | | public static List<Model.AssetsManufacturerMapping> GetSet(Func<List<Model.AssetsManufacturerMapping>> func, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); |