我想利用在.net MVC 3甜甜圈缓存功能对于我的主页,在我家的控制器,我有:如何删除ChildAction上的OutputCache?
public ActionResult Index()
{
return View();
}
[ChildActionOnly]
[OutputCache(Duration=3600)]
public ActionResult IndexMain()
{
return PartialView(ViewModelRepository.GetIndexViewModel());
}
我我的观点,我有:
<% Html.RenderAction("IndexMain");%>
这一切工作正常。然而,当数据发生变化,我跑:
var urlToRemove = Url.Action("IndexMain", "Home");
Response.RemoveOutputCacheItem(urlToRemove);
的RemoveOutputCacheItem的执行没有错误,但ChildAction缓存中没有失效。有没有办法从ChildAction中以编程方式删除缓存项目?
一对夫妇更多的联系:http://stackoverflow.com/a/7530265/63733,http://thenullreference.com/blog/fixing-the-asp -net-mvc-3-outputcacheattribute-for-partial-views-to-honor-some-web-config-settings /,http://stackoverflow.com/a/7117242/63733 – marapet 2013-03-26 09:42:18