日期:2014-05-17  浏览次数:20341 次

急 !在线等 有关缓存的问题!
如何获取所有的缓存项
 public static DataSet GetCacheByKey(string key)
 {
  //如何写
}

------解决方案--------------------
C# code
/// <summary>
        /// 获取所有缓存对象的key
        /// </summary>
        /// <returns>返回一个IList对象</returns>
        public static IList<string> GetKeys()
        {
            List<string> keys = new List<string>();
            IDictionaryEnumerator cacheItem =HttpRuntime.Cache.GetEnumerator();
            while (cacheItem.MoveNext())
            {
                keys.Add(cacheItem.Key.ToString());
            }
            return keys.AsReadOnly();
        }

------解决方案--------------------
http://www.cnblogs.com/wenanry/archive/2008/08/13/1267028.html