Class CacheItem
Class that represents a cached item including its dependencies, expiration and eviction information
Inheritance
Namespace:
Assembly: Alachisoft.NCache.Web.dll
Syntax
public class CacheItem : ICloneable
Examples
You can create an instance of CacheItem class and Add(String, Object) it to the Cache
object someData = new object();
CacheItem item = new CacheItem(someData);
item.SlidingExpiration = new TimeSpan(0,5,0);
item.Priority = CacheItemPriority.High;
item.ItemRemoveCallback = onRemove;
Cache cache = NCache.InitializeCache("myCache");
cache.Add("someData", item);
Name | Description |
---|---|
CacheItem(Object) | Constructor |
Name | Description |
---|---|
AbsoluteExpiration | The time at which the added object expires and is removed from the cache. |
AsyncItemAddCallback | A delegate that, if provided, is called when an Asynchronous request for Add Operation completes. You can use this to obtain the results of an 'AddAsync' operation. |
AsyncItemUpdateCallback | A delegate that, if provided, is called when an Asynchronous request for Update Operation completes. You can use this to obtain the results of an 'InsertAsync' operation. |
CreationTime | Get the cache item creation time |
Dependency | The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this property contains a null reference (Nothing in Visual Basic). |
Group | The name of the group to associate with the cache item. All cache items with the same group name are logically grouped together. |
IsResyncExpiredItems | Gets/Sets a value indicating whether the object when expired will cause a re-fetch of the object from the master datasource. (Resync Expired Items) |
ItemRemoveCallback | A delegate that, if provided, is called when an object is removed from the cache. You can use this to notify applications when their objects are deleted from the cache. |
ItemUpdateCallback | A delegate that, if provided, is called when an object is updated in the cache. You can use this to notify applications when their objects are updated in the cache. |
LastModifiedTime | Get the cache item last modified time |
NamedTags | Get or set the named tags |
Priority | The relative cost of the object, as expressed by the enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost. |
ResyncProviderName | Gets/Sets Provider name for re-synchronization of cache |
SlidingExpiration | The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed. |
SubGroup | The name of the sub-group within a group. This hierarchical grouping gives more control over the cache items. |
SyncDependency | CacheSyncDependency for this item. |
Tags | Get or set the tags |
Value | The actual object provided by the client application. |
Version | Get or Set the cache item version |
Name | Description |
---|---|
Clone() | Creates a shallow copy of CacheItem |
SetCacheDataNotification(CacheDataNotificationCallback, EventType) | You can use this to notify applications when their objects are updated or removed in the cache.
Callbacks can be registered against |
SetCacheDataNotification(CacheDataNotificationCallback, EventType, EventDataFilter) | You can use this to notify applications when their objects are updated or removed in the cache.
Callbacks can be registered against |