技術(shù)頻道導(dǎo)航
HTML/CSS
.NET技術(shù)
IIS技術(shù)
PHP技術(shù)
Js/JQuery
Photoshop
Fireworks
服務(wù)器技術(shù)
操作系統(tǒng)
網(wǎng)站運(yùn)營

贊助商

分類目錄

贊助商

最新文章

搜索

CacheProfile實(shí)例 OutputCache緩存時(shí)間優(yōu)先outputCacheProfiles

作者:admin    時(shí)間:2012-11-19 23:55:43    瀏覽:

CacheProfile是OutputCache緩存的一個(gè)參數(shù),用于定義與該頁關(guān)聯(lián)的緩存設(shè)置的名稱。是可選屬性,默認(rèn)值為空字符("")。

需要注意的是,包含在用戶控件中的@ OutputCache指令不支持此屬性。在頁面中指定此屬性時(shí),屬性值必須與Web.config文件<outputCacheSettings>配置節(jié)下的outputCacheProfiles元素中的一個(gè)可用項(xiàng)的名稱匹配。如果此名稱與配置文件項(xiàng)不匹配,將引發(fā)異常。

CacheProfile 屬性

獲取或設(shè)置 OutputCacheProfile 名稱,該名稱與輸出緩存項(xiàng)的設(shè)置關(guān)聯(lián)。
命名空間:   System.Web.UI
程序集:  System.Web(在 System.Web.dll 中)

◇語法:

Public Property CacheProfile As String
1. public string CacheProfile { get; set; }

public:

property String^ CacheProfile {
 String^ get ();
 void set (String^ value);
}
member CacheProfile : string with get, set

◇屬性值
類型: SystemString
與輸出緩存項(xiàng)的設(shè)置關(guān)聯(lián)的 OutputCacheProfile 名稱。

◇備注
配置文件標(biāo)識 <outputCacheSettings> 配置中的一組緩存設(shè)置(用作輸出緩存項(xiàng)的基本設(shè)置)。

◇版本信息
.NET Framework
受以下版本支持:4.5、4、3.5、3.0、2.0

◇平臺
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008(不支持服務(wù)器核心角色), Windows Server 2008 R2(支持帶 SP1 或更高版本的服務(wù)器核心角色;不支持 Itanium)

.NET Framework 并不是對每個(gè)平臺的所有版本都提供支持。

示例:

<%@ OutputCache CacheProfile="Cache30Seconds" %>

配置:

Web.config

<caching>
  <outputCacheSettings>
    <outputCacheProfiles>
      <add name="Cache30Seconds" duration="30"
        varyByParam="none" />
    </outputCacheProfiles>
  </outputCacheSettings>
</caching>

Add節(jié)里面的各個(gè)屬性和OutPutCache相對應(yīng)

注意:

OutputCache生命優(yōu)先于outputCacheProfiles配置,比如:OutputCache頁面緩存10s,outputCacheProfiles設(shè)置緩存20s,則最后緩存10s。查看OutputCache緩存使用的詳細(xì)介紹

x
  • 站長推薦
/* 左側(cè)顯示文章內(nèi)容目錄 */