asp.net-mvc – 如何在ChildAction上删除OutputCache?
发布时间:2020-12-16 07:09:28 所属栏目:asp.Net 来源:网络整理
导读:我正在尝试利用.Net MVC 3中的甜甜圈缓存功能.对于我的主页,在我的家庭控制器中,我有: public ActionResult Index(){ return View();}[ChildActionOnly][OutputCache(Duration=3600)]public ActionResult IndexMain(){ return PartialView(ViewModelReposit
我正在尝试利用.Net MVC 3中的甜甜圈缓存功能.对于我的主页,在我的家庭控制器中,我有:
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中删除缓存项? 解决方法
您是否尝试过使用VaryBy属性,例如
VaryByParam or VaryByCustom
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – ASMX Web服务对传入请求使用错误编码
- Asp.net mvc 知多少(八)
- asp.net-mvc-2 – 使用Ninject返回null的HttpHandler属性注
- asp.net-mvc – ASP.NET MVC控制器的[Authorize]属性仅适用
- ASP.NET MVC4异步聊天室
- .net – 为每个操作设置MaxAllowedContentLength / maxRequ
- ASP.NET解决方案与类库项目
- asp.net-mvc-3 – 指定Html.TextBoxFor的大小和最大长度
- asp.net-mvc – 好的WiX编辑器
- asp.net – IIS表达请求的执行时间要长4倍
推荐文章
站长推荐
热点阅读