【发布时间】:2014-02-13 07:17:09
【问题描述】:
我正在尝试在 MVC 4.0 ASP.net 应用程序中实现缓存。我可以使用 outputcache 进行缓存
[OutputCache (Duration=60)]
public ActionResult myaction(string parm1)
{
--logic to construct the model object
-- followed by this return statement
return PartialView(model);
}
但我需要在编辑存储在 xml 文件中的数据后清除缓存。
所以我尝试添加
HttpResponse.RemoveOutputCacheItem(Url.Action("myaction", "myController"));
在调用return RedirectToAction(myaction);之前在同一控制器的另一个动作中
但是缓存没有被重置。
这是使用动作刷新输出缓存的方法吗?我使用 ajax 从 jquery 调用这些操作。
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-4 caching