/// <summary> /// 清除缓存 /// </summary> public ActionResult _ResetCache() { ICacheService cacheService = DIContainer.Resolve<ICacheService>(); cacheService.Clear(); OutputCacheManager outputCacheManager = new OutputCacheManager(); outputCacheManager.RemoveItems(); return Redirect(SiteUrls.Instance().ControlPanelSuccess("执行成功", SiteUrls.Instance().ControlPanelTool())); }
private void ClearCache() { try { //Clear all output cache so everything is refreshed. var cacheManager = new OutputCacheManager(); cacheManager.RemoveItems(); } catch (Exception ex) { LogHelper.Error<UmbracoEvents>(string.Format("Exception: {0} - StackTrace: {1}", ex.Message, ex.StackTrace), ex); } }
private void ClearCache() { try { //Clear all output cache so everything is refreshed. var cacheManager = new OutputCacheManager(); cacheManager.RemoveItems(); } catch (Exception ex) { Log.Add(LogTypes.Error, -1, string.Format("Exception: {0} - StackTrace: {1}", ex.Message, ex.StackTrace)); } }
public override void ProcessRequest(HttpRequest req, HttpResponse res) { if (req.QueryString.Count == 0) { res.Write("<p><h1>网站当前缓存列表:</h1><p>"); var cacheItemList = new List<string>(); var s = "<a href='?cacheclear=true' target='_blank'>!点击清除所有缓存</a>"; cacheItemList.Add(s); var cacheEnumerator = HttpRuntime.Cache.GetEnumerator(); while (cacheEnumerator.MoveNext()) { var key = cacheEnumerator.Key.ToString(); s = string.Format("<b>{0}</b>:{1}(<a href='?key={0}' target='_blank'>查看数据</a>)", key, cacheEnumerator.Value.GetType()); cacheItemList.Add(s); } cacheItemList.Sort(); res.Write(string.Join("<hr>", cacheItemList)); } else if(req["cacheclear"] != null) { CacheHelper.Clear(); var cacheManager = new OutputCacheManager(); cacheManager.RemoveItems(); res.Write("清除缓存成功!"); } else if (req["key"] != null) { var data = CacheHelper.Get(req["key"]); if (data != null) res.Write(Newtonsoft.Json.JsonConvert.SerializeObject(data)); } }
private void ClearCache() { try { //Clear all output cache so everything is refreshed. var cacheManager = new OutputCacheManager(); cacheManager.RemoveItems(); //Clear the content finder cache. HttpContext.Current.Cache.Remove("CachedNewsNodes"); } catch (Exception ex) { LogHelper.Error<UmbracoEvents>(string.Format("Exception: {0} - StackTrace: {1}", ex.Message, ex.StackTrace), ex); } }