Esempio n. 1
0
        /// <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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
 /// <summary>
 /// 增加一项
 /// </summary>
 /// <param name="info"></param>
 internal void Add(CacheItemInfo info)
 {
     List.Add(info);
 }
Esempio n. 4
0
		/// <summary>
		/// 增加一项
		/// </summary>
		/// <param name="info"></param>
		internal void Add(CacheItemInfo info)
		{
			List.Add(info);
		}