How to Clear OutputCache for Website without Restarting App

后端 未结 2 1739
长发绾君心
长发绾君心 2021-01-02 03:08

Is there a way clear or reset the outputcache for an entire website without a restart?

I\'m just starting to use outputcache on a site and when I make a mistake in s

相关标签:
2条回答
  • 2021-01-02 03:36

    Add the following code to controller or to page code:

    HttpContext.Cache.Insert("Page", 1);
    Response.AddCacheItemDependency("Page");
    

    To clear output cachne use the following command in controller:

        HttpContext.Cache.Remove("Page");
    
    0 讨论(0)
  • 2021-01-02 03:44

    This should do the trick:

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    
     Dim path As String
     path="/AbosoluteVirtualPath/OutputCached.aspx"
     HttpResponse.RemoveOutputCacheItem(path)
    
    End Sub
    
    0 讨论(0)
提交回复
热议问题