當使用@OutputCache指令,你可以定義緩存配置文件作爲在web.config中如下:ASP.NET outputCacheProfiles可以與Response.Cache一起使用嗎?
<system.web>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="myprofile" duration="30" enabled="true" varyByParam="myfield"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
然而,在我的應用程序,我有需要,而不是使用聲明如程序緩存一些網頁:
Response.Cache.SetExpires(DateTime.Now.AddSeconds(5));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(true);
是否可以使用Response.Cache並利用outputCacheProfiles? 例如,
Response.Cache.ApplyCacheProfile("myprofile");
我呼籲ApplyCacheProfile屬性()只是僞代碼。該方法不存在。我問是否存在這種方法。 – frankadelic 2010-12-24 00:56:53