I am trying to implement caching in an MVC 4.0 ASP.net application. I can cache using outputcache
[OutputCache (Duration=60)]
public ActionResult myaction(string parm1)
{
--logic to construct the model object
-- followed by this return statement
return PartialView(model);
}
But I need to clear the cache after editing data which is stored in an xml file.
So I tried to add
HttpResponse.RemoveOutputCacheItem(Url.Action("myaction", "myController"));
in another action of the same controller before calling return RedirectToAction(myaction);
But the cache is not getting reset.
Is this the method to refresh outputcache using actions? I call these actions from jquery using ajax.