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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Caching;
using System.Text;
 
namespace IStation
{
    /// <summary>
    /// 待编写
    /// </summary>
    internal sealed partial class SharedMemoryCache : IMemoryCacheDirect
    {
        /// <summary>
        /// 单例模式(延迟加载)
        /// </summary>
        private static readonly Lazy<SharedMemoryCache> _lazy = new Lazy<SharedMemoryCache>(() => new SharedMemoryCache());
 
        /// <summary>
        /// MemoryCache 实例
        /// </summary>
        private MemoryCache _memoryCache;
 
        /// <summary>
        /// 如果每个调用中未提供缓存项策略,则使用可选的默认缓存项策略
        /// </summary>
        public CacheItemPolicy DefaultPolicy { get; set; } = null;
 
        /// <summary>
        /// 当前正在设置缓存项的缓存键集合
        /// Collection of all cache keys currently executing a function to set a cache item
        /// </summary>
        private ConcurrentDictionary<string, CacheKeyBeingHandled> _cacheKeysBeingHandled;
 
        /// <summary>
        /// Locker object
        /// </summary>
        private object _wipeLock = new object();
 
        /// <summary>
        /// 标识Wipe方法是否正在执行
        /// State flag indicating whether the wipe method is currently being executed
        /// </summary>
        private bool _isWiping = false;
 
        /// <summary>
        /// Locker object, used to lock set operations when a wipe is in progress
        /// </summary>
        private object _setLock = new object();
 
        /// <summary>
        /// State flag indicating whether any non-waitable set action is currently being executed
        /// </summary>
        private bool _isSetting = false;
 
 
 
    }
 
}