Beispiel #1
0
        /// <summary>
        /// 获取所有缓存键
        /// </summary>
        /// <returns></returns>
        public static List <string> GetCacheKeys()
        {
            const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
            var entries    = AppCache.GetType().GetField("_entries", flags).GetValue(AppCache);
            var cacheItems = entries as IDictionary;
            var keys       = new List <string>();

            if (cacheItems == null)
            {
                return(keys);
            }
            foreach (DictionaryEntry cacheItem in cacheItems)
            {
                keys.Add(cacheItem.Key.ToString());
            }
            return(keys);
        }