public static Caches GetCaches() { Cache _cache = HttpRuntime.Cache; IDictionaryEnumerator cacheEnum = _cache.GetEnumerator(); CacheList cl = new CacheList(); cl = new CacheList(); while (cacheEnum.MoveNext()) { cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString())); } Caches rs = new Caches(); rs.CacheList = new CacheList(); cl.SortBy(CacheInfo.Columns.Key, true); rs.CacheList.AddRange(cl); rs.Total = cl.Count; return rs; }
private static Caches GetCaches(bool isGetAll, int pageIndex, int pageSize, string sort, bool isAsc, string cacheKey, string cacheType) { Cache _cache = HttpRuntime.Cache; IDictionaryEnumerator cacheEnum = _cache.GetEnumerator(); CacheList cl = new CacheList(); cl = new CacheList(); while (cacheEnum.MoveNext()) { if (!string.IsNullOrEmpty(cacheKey) && cacheEnum.Key.ToString().ToUpper().IndexOf(cacheKey.ToUpper()) < 0) continue; if (!string.IsNullOrEmpty(cacheType) && cacheEnum.Value.GetType().ToString().ToUpper().IndexOf(cacheType.ToUpper()) < 0) continue; cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString())); } Caches rs = new Caches(); rs.CacheList = new CacheList(); if (isGetAll) { cl.SortBy(sort, isAsc); rs.CacheList.AddRange(cl); } else rs.CacheList.AddRange(cl.GetPaging(pageSize, pageIndex, sort, isAsc)); rs.Total = cl.Count; return rs; }