Export (0) Print
Expand All

CacheItemPriority Enumeration

Specifies the relative priority of items stored in the Cache.

[Visual Basic]
<Serializable>
Public Enum CacheItemPriority
[C#]
[Serializable]
public enum CacheItemPriority
[C++]
[Serializable]
__value public enum CacheItemPriority
[JScript]
public
   Serializable
enum CacheItemPriority

Remarks

When the Web server hosting an ASP.NET application runs low on memory, the Cache selectively purges items to free system memory. When an item is added to the cache, you can assign it a relative priority compared to the other items stored in the cache. Items you assign higher priority values to are less likely to be deleted from the cache when the server is processing a large number of requests, while items you assign lower priority values are more likely to be deleted. The default is Normal.

Members

Member name Description
AboveNormal Cache items with this priority level are less likely to be deleted as the server frees system memory than those assigned a Normal priority.
BelowNormal Cache items with this priority level are more likely to be deleted from the cache as the server frees system memory than items assigned a Normal priority.
Default The default value for a cached item's priority is Normal.
High Cache items with this priority level are the least likely to be deleted from the cache as the server frees system memory.
Low Cache items with this priority level are the most likely to be deleted from the cache as the server frees system memory.
Normal Cache items with this priority level are likely to be deleted from the cache as the server frees system memory only after those items with Low or BelowNormal priority. This is the default.
NotRemovable The cache items with this priority level will not be deleted from the cache as the server frees system memory.

Example

[Visual Basic, C#, C++] The following example uses the Insert method to add an item to the Cache object with its priority parameter set to CacheItemPriority.High.

[Visual Basic] 
Cache.Insert("DSN", connectionString, Nothing, d, t, CacheItemPriority.High, onRemove)

[C#] 
Cache.Insert("DSN", connectionString, null, d, t, CacheItemPriority.High, onRemove);
   

[C++] 
Cache->Insert(S"DSN", connectionString, 0, d, t, CacheItemPriority::High, onRemove);
   

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Web.Caching

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

System.Web.Caching Namespace | Cache | Caching Application Data

Show:
© 2014 Microsoft