[英]how to pipe stdout to browser in Mono Apache MVC2 application
[英]How to clear OutputCache in Mono MVC2 application
AddCacheItemDependency用於使用下面的代碼在Mono Apache MVC2應用程序中清除OutputCache。 在ASP.NET中清除頁面緩存中對此進行了描述
在Mono中,不清除OutputCache。 查看GitHub中的源代碼可知,在Mono中未實現AddCacheItemDependency。 如何解決此問題,以便可以清除OutputCache?
安德魯斯。
[OutputCache(Duration = 3600, VaryByParam = "none")]
public ActionResult Index()
{
HttpContext.Current.Response.AddCacheItemDependency("Pages");
return View();
}
public ActionResult Refresh()
{
HttpRuntime.Cache.Insert( "Pages", DateTime.Now);
}
在Global.asax.cs中:
protected void Application_Start()
{
HttpRuntime.Cache.Insert( "Pages", DateTime.Now);
}
您是否嘗試過手動刪除輸出緩存?
喜歡:
var urls = new List<string> {
Url.Action("Index", "ControllerName", new { area = "AreaName" }))
};
urls.ForEach(HttpResponse.RemoveOutputCacheItem);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.