コード例 #1
0
ファイル: CacheQueue.cs プロジェクト: ounata/AK47-2016Source
        /// <summary>
        /// 得到所有项的信息
        /// </summary>
        /// <returns></returns>
        public override CacheItemInfoCollection GetAllItemsInfo()
        {
            CacheItemInfoCollection result = new CacheItemInfoCollection();

            this.rWLock.AcquireReaderLock(this.lockTimeout);
            try
            {
                foreach (KeyValuePair <TKey, CacheItem <TKey, TValue> > kp in this.innerDictionary)
                {
                    CacheItemInfo itemInfo = new CacheItemInfo();

                    result.Add(kp.Value.ToCacheItemInfo());
                }
            }
            finally
            {
                this.rWLock.ReleaseReaderLock();
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 转换成Cache的信息项
        /// </summary>
        /// <returns></returns>
        public CacheItemInfo ToCacheItemInfo()
        {
            CacheItemInfo itemInfo = new CacheItemInfo();

            if (this.key != null)
            {
                itemInfo.Key = this.key.ToString();
            }
            else
            {
                itemInfo.Key = "(null)";
            }

            if (this.tValue != null)
            {
                itemInfo.Value = this.tValue.ToString();
            }
            else
            {
                itemInfo.Value = "(null)";
            }

            return(itemInfo);
        }
コード例 #3
0
 /// <summary>
 /// 增加一项
 /// </summary>
 /// <param name="info"></param>
 internal void Add(CacheItemInfo info)
 {
     List.Add(info);
 }
コード例 #4
0
		/// <summary>
		/// 增加一项
		/// </summary>
		/// <param name="info"></param>
		internal void Add(CacheItemInfo info)
		{
			List.Add(info);
		}