共用方式為


CachingSection 類別

設定輸出和核心快取。

Syntax

class CachingSection : ConfigurationSectionWithCollection  

方法

下表列出 類別所 CachingSection 公開的方法。

名稱 描述
加入 (繼承自 ConfigurationSectionWithCollection.)
清除 (繼承自 ConfigurationSectionWithCollection。)
Get (繼承自 ConfigurationSectionWithCollection。)
GetAllowDefinition (繼承自 ConfigurationSection.)
GetAllowLocation (繼承自 ConfigurationSection。)
移除 (繼承自 ConfigurationSectionWithCollection。)
RevertToParent (繼承自 ConfigurationSection。)
SetAllowDefinition (繼承自 ConfigurationSection。)
SetAllowLocation (繼承自 ConfigurationSection。)

屬性

下表列出 類別所 CachingSection 公開的屬性。

名稱 描述
Enabled 讀取/寫入 boolean 值。 如果啟用輸出快取,則為 true,否則為 false。 如果輸出快取已停用,則不會發生回應輸出快取或核心快取。 預設值為 true
EnableKernelCache 讀取/寫入 boolean 值。 如果啟用核心快取,就是 true,否則就是 false。 預設為 true
Location (繼承自 ConfigurationSection .) 索引鍵屬性。
MaxCacheSize 讀取/寫入 uint32 值,指定輸出快取的大小上限,以 MB 為單位。 預設值是 0。 值為 0 表示會自動管理快取記憶體大小。 的大小 MaxValue 表示快取大小沒有限制。 注意: 此設定只有在ApplicationHost.config檔案層級才有效。 如果您將此屬性設定為較低層級,則不會有任何作用。
MaxResponseSize 讀取/寫入 uint32 值,指定可儲存在輸出快取中之回應的大小上限,以位元組為單位。 預設值為 262144 (256KB) 。 設定為 0 表示沒有限制。 注意: 此設定只有在ApplicationHost.config檔案層級才有效。 如果您將此屬性設定為較低層級,則不會有任何作用。
Path (繼承自 ConfigurationSection .) 索引鍵屬性。
Profiles CachingProfileSettings值,可設定特定要求延伸模組的快取。
SectionInformation (繼承自 ConfigurationSection。)

子類別

這個類別不包含子類別。

範例

下列範例會顯示預設網站 物件中的 CachingSection 屬性,包括 CachingProfileSettings 陣列屬性中的 Profiles 值。 提供兩個協助程式函式來顯示 、 KernelCachePolicyLocation 列舉的文字 Policy

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get the CachingSection for the default Web site.  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
oSite.GetSection "CachingSection", oSection  
  
' Display the path and location.  
Wscript.Echo "Path: " & oSection.Path  
Wscript.Echo "Location: " & oSection.Location  
Wscript.Echo   
  
' Display other non-array CachingSection properties.  
WScript.Echo "Enabled: " & oSection.Enabled  
Wscript.Echo "EnableKernelCache: " & oSection.EnableKernelCache  
Wscript.Echo "MaxCacheSize: " & oSection.MaxCacheSize  
Wscript.Echo "MaxResponseSize: " & oSection.MaxResponseSize  
Wscript.Echo   
  
' Display the caching profiles from the Profiles property.  
For Each oCachingProfileElement In oSection.Profiles.Profiles  
    Wscript.Echo   
    WScript.Echo "[ " & oCachingProfileElement.Extension & _  
        " ] Caching Profile"  
    WScript.Echo "-----------------------------------"  
    WScript.Echo "Duration: " & oCachingProfileElement.Duration  
    WScript.Echo "KernelCachePolicy: " & _  
        CachePolicyText(oCachingProfileElement.KernelCachePolicy)  
    WScript.Echo "Location: " & _  
        LocationText(oCachingProfileElement.Location)  
    WScript.Echo "Policy: " & _  
        CachePolicyText(oCachingProfileElement.Policy)  
    WScript.Echo "VaryByHeaders: " & _  
        oCachingProfileElement.VaryByHeaders  
    WScript.Echo "VaryByQueryString: " & _  
        oCachingProfileElement.VaryByQueryString  
    WScript.Echo               
Next  
  
' Provide text for KernelCachePolicy and Policy enumeration values.  
Function CachePolicyText(enumval)  
Select Case enumval  
    Case 0  
        CachePolicyText="DontCache"  
    Case 1  
        CachePolicyText="CacheUntilChange"  
    Case 2  
        CachePolicyText="CacheForTimePeriod"  
    Case Else  
        CachePolicyText="Undefined enumeration value"  
End Select  
End Function  
  
' Provide text for Location enumeration values.  
Function LocationText(enumval)  
Select Case enumval  
    Case 0  
        LocationText="Any"  
    Case 1  
        LocationText="Client"  
    Case 2  
        GetLocationText="Downstream"  
    Case 3  
        LocationText="Server"  
    Case 4  
        LocationText="None"  
    Case 5  
        LocationText="ServerAndClient"  
    Case Else  
        LocationText="Undefined enumeration value"  
End Select  
End Function  
  

繼承階層架構

ConfigurationSection

ConfigurationSectionWithCollection

CachingSection

規格需求

類型 描述
Client - Windows Vista 上的 IIS 7.0
- Windows 7 上的 IIS 7.5
- Windows 8 上的 IIS 8.0
- Windows 10上的 IIS 10.0
伺服器 - Windows Server 2008 上的 IIS 7.0
- Windows Server 2008 R2 上的 IIS 7.5
- Windows Server 2012 上的 IIS 8.0
- Windows Server 2012 R2 上的 IIS 8.5
- Windows Server 2016上的 IIS 10.0
產品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 檔案 WebAdministration.mof

另請參閱

AspCache 類別
CachingProfileElement 類別
CachingProfileSettings 類別
ConfigurationSection 類別
ConfigurationSectionWithCollection 類別
HttpClientCache 類別