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;
|
|
|
|
}
|
|
}
|