tangxu
2024-01-09 ddc2780231ea76be74fadb7486401a3d0d17b101
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
namespace Yw.Service
{
    /// <summary>
    /// HealthQuotaEvaluationModel
    /// 缓存辅助类
    /// </summary>
    internal class HealthQuotaEvaluationModelCacheHelper
    {
        private const string _contentKey = "HealthQuotaEvaluationModelList";
 
        private static string GetCacheKey()
        {
            return CacheHelper.GetCacheKey(_contentKey);
        }
 
        /// <summary>
        /// 设置缓存
        /// </summary>
        public static void Set(List<Model.HealthQuotaEvaluationModel> 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.HealthQuotaEvaluationModel> Get()
        {
            var cacheKey = GetCacheKey();
            return MemoryCacheHelper.Get<List<Model.HealthQuotaEvaluationModel>>(cacheKey);
        }
 
        /// <summary>
        /// 获取设置缓存
        /// </summary>
        public static List<Model.HealthQuotaEvaluationModel> GetSet(Func<List<Model.HealthQuotaEvaluationModel>> 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);
        }
 
 
    }
}