0
如何使用系統緩存對象HttpContext.Current.Cache將自定義服務器控件存儲在緩存中?如何緩存複合服務器控件?
目前,我有代碼看起來像這樣:
string adxkey = string.Format("adxdependency:document:{0}", this.SearchRootDocumentKey);
System.Web.Caching.CacheDependency cd = new System.Web.Caching.CacheDependency(null, new string[] { adxkey });
HttpContext.Current.Cache.Insert(adxkey, this, cd);
這是位於詮釋,他的OnInit方法。我的問題是:
- 有沒有更好的方法來放置緩存代碼?
- 您是否可以通過像上面那樣傳遞對它的引用來緩存服務器控件?或者我需要緩存呈現的HTML?
如何以編程方式緩存服務器控件的示例將不勝感激!謝謝。