Example #1
0
 public NWaySetAssociativeCache(int n, ICacheIndexer <K> cacheIndexer)
 {
     CacheIndexer           = cacheIndexer;
     N                      = n;
     CacheMap               = new ConcurrentDictionary <int, CacheLine <K, V> >();
     EvictionPolicyInstance = new EvictionPolicy();
 }
Example #2
0
 /// <summary>
 ///     内存段缓存项,提供了相关的基本操作
 /// </summary>
 /// <param name="indexer">缓存索引器</param>
 /// <exception cref="ArgumentNullException">参数不空为能</exception>
 public SegmentCacheItem(ICacheIndexer indexer)
 {
     if (indexer == null)
     {
         throw new ArgumentNullException(nameof(indexer));
     }
     _indexer = indexer;
 }
Example #3
0
 /// <summary>
 ///     内存段缓存存根,提供了相关的基本操作
 /// </summary>
 /// <param name="indexer">缓存索引器</param>
 /// <param name="expireTime">过期时间</param>
 /// <exception cref="ArgumentNullException">参数不能为空</exception>
 public SegmentCacheStub(ICacheIndexer indexer, DateTime expireTime)
 {
     if (indexer == null)
     {
         throw new ArgumentNullException(nameof(indexer));
     }
     _indexer   = indexer;
     _lease     = new CacheLease(expireTime);
     _innerItem = new SegmentCacheItem(indexer);
     Fixed      = true;
 }
Example #4
0
 /// <summary>
 ///     内存段缓存存根,提供了相关的基本操作
 /// </summary>
 /// <param name="indexer">缓存索引器</param>
 /// <exception cref="ArgumentNullException">参数不能为空</exception>
 public SegmentCacheStub(ICacheIndexer indexer) : this(indexer, DateTime.MaxValue)
 {
 }