共用方式為


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 內部快取或輸出快取。 關於不同快取類型的更多資訊,請參見快取。

適用於

另請參閱