2011-11-15 31 views
5

Tôi có một trang có các điều khiển là bộ đệm đầu ra (bộ nhớ đệm đầu ra một phần). Đây là những thiết lập như thế này:Xóa bộ nhớ đệm đầu ra một phần

[PartialCaching(86400, null, null, "campaign.whatwhere", true)] 
public partial class controls_LatestEnquiriesListCached : System.Web.UI.UserControl 
{ 

... 

Với

public override string GetVaryByCustomString(HttpContext context, string custom) 
{ 
    if (custom == "campaign.whatwhere") 
    { 
     return (CampaignManager.CurrentCampaign.DefaultWorkTypeId ?? 0).ToString() + (CampaignManager.CurrentCampaign.DefaultEnquiryAreaId ?? 0).ToString(); 
    } 
    return base.GetVaryByCustomString(context, custom); 
} 

Trong Global.asax

Làm thế nào tôi có thể thiết lập để tôi có thể xóa bộ nhớ cache sản lượng này trên một trang cụ thể?

Có thể thiết lập như MyPageWithCachedControl.aspx?ClearCache=true ???

+0

chính xác bản sao của http://stackoverflow.com/questions/565239/any-way-to-clear-flush-remove-outputcache – Ramesh

+0

Cũng http://stackoverflow.com/question/37101/how-to-clear-outputcache-cho-website-without-restarting-app – Ramesh

+0

Các bản sao chính xác này như thế nào? –

Trả lời

0

Bạn có thể tạo trang aspx không làm gì ngoài xóa bộ nhớ cache. Bạn có thể lấy tham số chuỗi truy vấn và xóa nó bằng khóa bộ nhớ cache.

Hoặc bạn có thể thử tìm và quản lý bộ nhớ cache ASP.NET.

0

Bạn nên sử dụng HttpResponse.RemoveOutputCacheItem(path) để xóa bộ nhớ cache ra nơi đường dẫn là đường dẫn tuyệt đối ảo của người dùng điều khiển theo quy định tại các https://stackoverflow.com/a/37167/30594

0

Sử dụng HTTPResponse.RemoveOutputCacheItem(pathofpage) để xóa bộ nhớ cache của một trang cụ thể.

Ví dụ:

private void Button1_Click(object sender, System.EventArgs e) 
{ 
    HttpResponse.RemoveOutputCacheItem("/form1.aspx"); 
}