예제 #1
0
        public override List <string> GetKeys(Func <string, bool> predicate = null)
        {
            var keys = _memoryCache.AsEnumerable().Select(t => t.Key);

            if (predicate == null)
            {
                return(keys.ToList());
            }
            else
            {
                return(keys.Where(predicate).ToList());
            }
        }
예제 #2
0
 /// <summary>
 ///     获取全部的缓存项。
 /// </summary>
 /// <returns>全部的缓存项。</returns>
 public virtual IEnumerable <KeyValuePair <string, object> > GetAll()
 {
     return(_cache.AsEnumerable());
 }