/// <summary> /// 清除所有全局缓存 /// </summary> public static void ClearAllGlobalCache() { if (GlobalCacheKeyList != null && GlobalCacheKeyList.Count > 0) { System.Web.Caching.Cache cache = HttpRuntime.Cache; foreach (string item in GlobalCacheKeyList) { cache.Remove(item); } GlobalCacheKeyList.Clear(); } }
/// <summary> /// 清除站点缓存 /// </summary> public static void ClearAllCache() { //清除全局缓存键列表中键及对应的缓存 if (GlobalCacheKeyList.Count > 0) { System.Web.Caching.Cache cache = HttpRuntime.Cache; foreach (string item in GlobalCacheKeyList) { cache.Remove(item); } GlobalCacheKeyList.Clear(); } //清除用户缓存键列表中键及对应的缓存 if (UserCacheKeyList.Count > 0) { System.Web.Caching.Cache cache = HttpRuntime.Cache; foreach (string item in UserCacheKeyList) { cache.Remove(item); } UserCacheKeyList.Clear(); } }