namespace Yw.Service { /// /// HealthMultiEvaluationModel /// 缓存辅助类 /// internal class HealthMultiEvaluationModelCacheHelper { private const string _contentKey = "HealthMultiEvaluationModelList"; private static string GetCacheKey() { return CacheHelper.GetCacheKey(_contentKey); } /// /// 设置缓存 /// public static void Set(List list, int Minites = 30, int RandomSeconds = 0) { var cacheKey = GetCacheKey(); MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); } /// /// 获取缓存 /// /// public static List Get() { var cacheKey = GetCacheKey(); return MemoryCacheHelper.Get>(cacheKey); } /// /// 获取设置缓存 /// public static List GetSet(Func> func, int Minites = 30, int RandomSeconds = 0) { var cacheKey = GetCacheKey(); return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); } /// /// 移除缓存 /// public static void Remove() { var cacheKey = GetCacheKey(); MemoryCacheHelper.Remove(cacheKey); } } }