/// <summary>
 /// 获取键的集合
 /// </summary>
 /// <returns>键的集合</returns>
 private ICollection <string> GetCacheKeys()
 {
     lock (locker)
     {
         IEnumerable <KeyValuePair <string, object> > items = cache.AsEnumerable();
         return(items.Select(m => m.Key).ToList());
     }
 }
Example #2
0
        public static List <string> Keys()
        {
            List <string> list = new List <string>();
            IEnumerable <KeyValuePair <string, object> > items = cache.AsEnumerable();

            foreach (KeyValuePair <string, object> item in items)
            {
                list.Add(item.Key);
            }
            return(list);
        }
        /// <summary>
        ///  Get Enumerator
        /// </summary>
        /// <returns></returns>

        public IEnumerator <KeyValuePair <string, object> > GetEnumerator()
        {
            return((IEnumerator <KeyValuePair <string, object> >)MemoryCache.AsEnumerable());
        }
 public IEnumerable <KeyValuePair <string, object> > GetEnumerable()
 {
     return(_Cache.AsEnumerable());
 }