2

AddCacheItemDependency is used to clear OutputCache in Mono Apache MVC2 application using code below. This is described in Clearing Page Cache in ASP.NET

In Mono, OutputCache is not cleared. Looking into source code in GitHub shows that AddCacheItemDependency is not implemented in Mono. How to fix this so that OutputCache can cleared ?

Andrus.

[OutputCache(Duration = 3600, VaryByParam = "none")]
public ActionResult Index()
{
  HttpContext.Current.Response.AddCacheItemDependency("Pages");
  return View();
}

public ActionResult Refresh()
{
HttpRuntime.Cache.Insert( "Pages", DateTime.Now);
}

in Global.asax.cs:

protected void Application_Start()
{
HttpRuntime.Cache.Insert( "Pages", DateTime.Now);
}
Community
  • 1
  • 1
Andrus
  • 26,339
  • 60
  • 204
  • 378

1 Answers1

0

Did you try remove output cache manually?

Like:

var urls = new List<string> {
                    Url.Action("Index", "ControllerName", new { area = "AreaName" }))
            };
urls.ForEach(HttpResponse.RemoveOutputCacheItem);
sulgpallur
  • 63
  • 5
  • This reqires knowing exact urls. Url can also contain query string parameters wchic can vary. How to get all urls which are in cache ? – Andrus Aug 03 '13 at 12:33