ningshuxia
2023-02-06 1fc0b4ed96d4c4b1ff7142926239998de32b2ada
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.BLL
{
    /// <summary>
    /// 缓存辅助类
    /// </summary>
    internal class CacheHelper
    {
        private const string _cacheKeyPrefix = "*Default_Main_Prefix*";//缓存键前缀
 
        /// <summary>
        /// 获取缓存键
        /// </summary>
        public static string GetCacheKey(string keyContent)
        {
            return string.Format("{0}_{1}", _cacheKeyPrefix, keyContent);
        }
 
        /// <summary>
        /// 清除全部
        /// </summary>
        public static void Clear()
        {
            MemoryCacheHelper.Remove((key) =>
            {
                return key.StartsWith(_cacheKeyPrefix);
            });
        }
 
 
 
 
 
    }
}