【发布时间】:2011-11-18 16:16:40
【问题描述】:
在我们正在构建的 MVC 应用程序的许多操作中,我们使用 OutputCache 如下:
[OutputCache(Duration = 3600, VaryByCustom = "language")]
public ActionResult SomeAction()
{
//Action..
}
所以,我想要一个可以手动刷新所有这些缓存的操作:
public ActionResult RefrescarCache()
{
var keys = HttpContext.Cache.Cast<DictionaryEntry>().ToList();
keys.ForEach(k => HttpContext.Cache.Remove(k.Key.ToString()));
ViewBag.operationResult= "The cache was flushed succesfully!";
return View();
}
事情,它似乎不起作用。我会感谢您的任何想法或建议!
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-3 c#-4.0 action outputcache