Is it possible to find all Action methods on all controllers that have been decorated with [OutputCache]
so I can then enumerate through them to remove selected
items from the cache in one go?
foreach(var .. in ...)
{
//get ActionName
//get ControllerName
HttpResponse.RemoveOutputCacheItem(Url.Action(ActionName, ControllerName));
}
According to this post it is not possible to invalidate the cache in one go.
Edit It looks like I can invalidate the ALL
the cache by simply doing this:-
public ActionResult Invalidate()
{
OutputCacheAttribute.ChildActionCache = new MemoryCache("NewDefault");
return View();
}
See this post for more info. However it would be nice to inval开发者_如何学Goidate portions of the cache depending say on controller name etc.
Looks like
public ActionResult Invalidate()
{
OutputCacheAttribute.ChildActionCache = new MemoryCache("NewDefault");
return View();
}
has done the trick...
精彩评论