有没有办法清除或重置整个网站的输出缓存而无需重新启动?

我刚刚开始在网站上使用输出缓存,当我在设置中犯了错误时,我需要一个可以浏览的页面来重置它。

有帮助吗?

解决方案

这应该可以解决问题:

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

其他提示

将以下代码添加到控制器或页面代码中:

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

要清除输出缓存,请在控制器中使用以下命令:

    HttpContext.Cache.Remove("Page");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top