Ejemplo n.º 1
0
        /// <summary>
        /// 构造函数,初始化具有Dependency的CacheItem
        /// </summary>
        /// <param name="tKey">初始化CacheItem的键值</param>
        /// <param name="data">CacheItem的Value</param>
        /// <param name="dependencyBase">与此CacheItem相关的Dependency,用以判断过期</param>
        /// <param name="cacheQueue"> 本CacheItem所属的CacheQueue的引用</param>
        public CacheItem(TKey tKey, TValue data, DependencyBase dependencyBase, CacheQueueBase cacheQueue)
            : base(cacheQueue)
        {
            this.key    = tKey;
            this.tValue = data;

            if (dependencyBase != null)
            {
                dependencyBase.CacheItem = this;
                dependencyBase.CacheItemBinded();
            }

            this.Dependency = dependencyBase;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="cacheQueueBase"></param>
 public CacheItemBase(CacheQueueBase cacheQueueBase)
 {
     this.cacheQueue = cacheQueueBase;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 构造函数,初始化没有Dependency的CacheItem
 /// </summary>
 /// <param name="tKey">初始化CacheItem的Key值</param>
 /// <param name="data">初始化CacheItem的Value值</param>
 /// <param name="cacheQueue">本CacheItem所属的CacheQueue的引用</param>
 public CacheItem(TKey tKey, TValue data, CacheQueueBase cacheQueue)
     : base(cacheQueue)
 {
     this.key    = tKey;
     this.tValue = data;
 }