Specifies the relative priority of items stored in the [!:Cache].

Namespace: Alachisoft.NCache.Runtime
Assembly: Alachisoft.NCache.Runtime (in Alachisoft.NCache.Runtime.dll) Version: 4.3.0.0 (4.3.0.0)

Syntax

C#
[SerializableAttribute]
public enum CacheItemPriority
Visual Basic
<SerializableAttribute>
Public Enumeration CacheItemPriority
Visual C++
[SerializableAttribute]
public enum class CacheItemPriority

Members

Member nameValueDescription
Low-2 Cache items with this priority level are the most likely to be deleted from the cache as the server frees system memory.
BelowNormal-1 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.
Normal0 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.
AboveNormal1 Cache items with this priority level are less likely to be deleted as the server frees system memory than those assigned a Normal priority.
High2 Cache items with this priority level are the least likely to be deleted from the cache as the server frees system memory.
NotRemovable3 The cache items with this priority level will not be deleted from the cache as the server frees system memory.
Default4 The default value for a cached item's priority is Normal.

Remarks

When the application's cache is full or 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.

Examples

The following example demonstrates how to insert an item in a [!:Cache] object with a CacheItemPriority of High.
 Copy imageCopy
NCache.Cache.Insert("DSN", connectionString, null, d, t, CacheItemPriority.High, onRemove);
Cache.Insert("DSN", connectionString, null, d, t, CacheItemPriority.High, onRemove);

See Also