共用方式為


CacheSection.DisableMemoryCollection 屬性

定義

取得或設定值,指出快取記憶體回收是否停用。

public:
 property bool DisableMemoryCollection { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("disableMemoryCollection", DefaultValue=false)]
public bool DisableMemoryCollection { get; set; }
[<System.Configuration.ConfigurationProperty("disableMemoryCollection", DefaultValue=false)>]
member this.DisableMemoryCollection : bool with get, set
Public Property DisableMemoryCollection As Boolean

屬性值

如果快取記憶體回收停用,則為 true,否則為 false。 預設為 false

屬性

範例

下列程式碼範例示範如何使用 DisableMemoryCollection 屬性。

// Enable or disable memory collection.
cacheSection.DisableMemoryCollection = 
        !cacheSection.DisableMemoryCollection;
' Enable or disable memory collection.
cacheSection.DisableMemoryCollection =
    Not cacheSection.DisableMemoryCollection

備註

DisableMemoryCollection如果 屬性設定 true 為 ,則對快取相關 API 的呼叫將不會有任何作用。

DisableMemoryCollection如果 屬性設定 true 為 ,則快取不會嘗試收集未使用的專案。 使用此設定時請小心,因為停用記憶體集合可能會快速導致應用程式的記憶體不足狀況。

此設定不會影響 ASP.NET 內部快取或輸出快取。 如需不同快取類型的詳細資訊,請參閱 快取

適用於

另請參閱