2012-10-16 1 views
2

AddCacheItemDependency는 아래 코드를 사용하여 Mono Apache MVC2 응용 프로그램에서 OutputCache를 지우는 데 사용됩니다. 이것은 설명되어 있습니다 Clearing Page Cache in ASP.NETMono MVC2 응용 프로그램에서 OutputCache를 지우는 방법

모노에서는 OutputCache가 지워지지 않습니다. GitHub의 소스 코드를 보면 AddCacheItemDependency가 Mono에 구현되어 있지 않다는 것을 알 수 있습니다. 이 문제를 해결하여 OutputCache를 지울 수 있습니까?

Andrus.

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

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

는 :

protected void Application_Start() 
{ 
HttpRuntime.Cache.Insert("Pages", DateTime.Now); 
} 

답변

0

은 수동 출력 캐시를 제거하려고 했습니까?

처럼 :

var urls = new List<string> { 
        Url.Action("Index", "ControllerName", new { area = "AreaName" })) 
      }; 
urls.ForEach(HttpResponse.RemoveOutputCacheItem); 
+0

이 알고 reqires 정확한 URL을. URL에는 검색어 문자열 매개 변수도 포함될 수 있습니다. 캐시에있는 모든 URL을 가져 오는 방법은 무엇입니까? – Andrus