wil*_*ilk 5 asp.net-mvc outputcache asp.net-mvc-3
我正在尝试利用.Net MVC 3中的甜甜圈缓存功能.对于我的主页,在我的家庭控制器中,我有:
public ActionResult Index()
{
return View();
}
[ChildActionOnly]
[OutputCache(Duration=3600)]
public ActionResult IndexMain()
{
return PartialView(ViewModelRepository.GetIndexViewModel());
}
Run Code Online (Sandbox Code Playgroud)
我的观点,我有:
<% Html.RenderAction("IndexMain");%>
Run Code Online (Sandbox Code Playgroud)
一切正常.但是,当数据发生变化时,我运行:
var urlToRemove = Url.Action("IndexMain", "Home");
Response.RemoveOutputCacheItem(urlToRemove);
Run Code Online (Sandbox Code Playgroud)
RemoveOutputCacheItem执行时没有错误,但ChildAction缓存未失效.有没有办法以编程方式从ChildAction中删除缓存项?
归档时间: |
|
查看次数: |
2125 次 |
最近记录: |