CacheSection.DisableMemoryCollection Property

Definition

Gets or sets a value indicating whether the cache memory collection is disabled.

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

Property Value

true if the cache memory collection is disabled; otherwise, false. The default is false.

Attributes

Examples

The following code example shows how to use the DisableMemoryCollection property.

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

Remarks

If the DisableMemoryCollection property is set to true, calls to the cache-related API will have no effect.

If the DisableMemoryCollection property is set to true, the cache does not attempt to collect unused items. Use caution when using this setting, as disabling memory collection can quickly lead to Out of Memory conditions for the application.

This setting has no effect on the ASP.NET internal cache or on the output cache. For more information about the different types of cache, see Caching.

Applies to

See also