com.alachisoft.jvcache.web.caching
Class CacheItem

java.lang.Object
  extended by com.alachisoft.jvcache.web.caching.CacheItem

public class CacheItem
extends java.lang.Object

Class that represents a cached item including its dependencies, expiration and eviction information


Constructor Summary
CacheItem(java.lang.Object value)
          Constructor
 
Method Summary
 java.lang.Object Clone()
          If dependency or ItemUpdateCallbacks are used in this cacheItem then it is a shallow copy, else this clone method observes a deep clone
 java.util.Date getAbsoluteExpiration()
          The time at which the added object expires and is removed from the cache.
 AsyncItemAddedCallback getAsyncItemAddedCallback()
          An instance that, if provided, is called when an Asynchronous request for Add Operation completes.
 AsyncItemUpdatedCallback getAsyncItemUpdatedCallback()
          An instance that, if provided, is called when an Asynchronous request for Update Operation completes.
 CacheSyncDependency getCacheSyncDependency()
          The cache key dependencies for the item.
 java.util.Date getCreationTime()
          Deprecated.  
 CacheDependency getDependency()
          The file or cache key dependencies for the item.
 Alachisoft.NCache.Common.BitSet getFlag()
          Deprecated.  
 java.lang.String getGroup()
          Group name, this caheItem is to be included in
 CacheItemRemovedCallback getItemRemoveCallback()
          An instance that, if provided, is called when an object is removed from the cache.
 CacheItemUpdatedCallback getItemUpdateCallback()
          An instance that, if provided, is called when an object is updated in the cache.
 java.util.Date getLastModifiedTime()
          Deprecated.  
 NamedTagsDictionary getNamedTags()
           
 CacheItemPriority getPriority()
          The relative cost of the object, as expressed by the enumeration.
 java.util.HashMap getQueryInfo()
          Deprecated.  
 boolean getResyncExpiredItems()
          Gets a value indicating whether the object when expired will cause a re-fetch of the object from the master datasource.
 java.lang.String getResyncProviderName()
           
 TimeSpan getSlidingExpiration()
          The interval between the time the added object was last accessed and when that object expires.
 java.lang.String getSubGroup()
          SubGroup name, this caheItem is to be included in
 Tag[] getTags()
          gets all tags this CacheItem is attached to
 java.lang.Object getValue()
          The payload for this item.
 CacheItemVersion getVersion()
          Item version of the object, used when getCachItem is used on Cache
 void setAbsoluteExpiration(java.util.Date absoluteExpiration)
          Sets the time at which the added object expires and is removed from the cache.
 void setAsyncItemAddedCallback(AsyncItemAddedCallback itemAddedCallback)
          An instance that, if provided, is called when an Asynchronous request for Add Operation completes.
 void setAsyncItemUpdatedCallback(AsyncItemUpdatedCallback itemUpdatedCallback)
          An instance that, if provided, is called when an Asynchronous request for Update Operation completes.
 void setCacheSyncDependency(CacheSyncDependency syncDependency)
          The cache key dependencies for the item.
 void setCreationTime(java.util.Date _creationTime)
          Deprecated.  
 void setDependency(CacheDependency dependency)
           
 void setFlag(Alachisoft.NCache.Common.BitSet Flag)
          Deprecated.  
 void setGroup(java.lang.String group)
          The name of the group to associate with the cache item.
 void setItemRemoveCallback(CacheItemRemovedCallback itemRemoveCallback)
          An instance that, if provided, is called when an object is removed from the cache.
 void setItemUpdateCallback(CacheItemUpdatedCallback itemUpdateCallback)
          An instance that, if provided, is called when an object is updated in the cache.
 void setLastModifiedTime(java.util.Date _lastModifiedTime)
          Deprecated.  
 void setNamedTags(NamedTagsDictionary namedTags)
           
 void setPriority(CacheItemPriority priority)
           
 void setPriority(int p)
          Set priority using integer value
 void setQueryInfo(java.util.HashMap queryInfo)
          Deprecated.  
 void setResyncExpiredItems(boolean resync)
           
 void setResyncProviderName(java.lang.String resyncProviderName)
           
 void setSlidingExpiration(TimeSpan slidingExpiration)
           
 void setSubGroup(java.lang.String subGroup)
          The name of the sub-group within a group.
 void setTags(Tag[] tags)
          sets all tags this CacheItem is to be attached to
 void setValue(java.lang.Object value)
           
 void setVersion(CacheItemVersion version)
          Sets Item Version
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheItem

public CacheItem(java.lang.Object value)
Constructor

Parameters:
value - Actual object to be stored in cache
Method Detail

getAbsoluteExpiration

public java.util.Date getAbsoluteExpiration()
The time at which the added object expires and is removed from the cache.

Returns:
The time at which the added object expires and is removed from the cache.

getDependency

public CacheDependency getDependency()
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.

Returns:
The CacheDependency of this Item.
See Also:
CacheDependency

getCacheSyncDependency

public CacheSyncDependency getCacheSyncDependency()
The 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.

Returns:
The CacheSyncDependency of this Item.
See Also:
CacheSyncDependency

getPriority

public CacheItemPriority getPriority()
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.

Returns:
CacheItemPriority object of this item.
See Also:
CacheItemPriority

getResyncExpiredItems

public boolean getResyncExpiredItems()
Gets a value indicating whether the object when expired will cause a re-fetch of the object from the master datasource. (Resync Expired Items)

Returns:
true/false

getSlidingExpiration

public TimeSpan getSlidingExpiration()
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.

Returns:
Date object specifying the sliding period for this item.

getValue

public java.lang.Object getValue()
The payload for this item.

Returns:
The value of the item.

getFlag

public Alachisoft.NCache.Common.BitSet getFlag()
Deprecated. 

Internal use only

Returns:

getGroup

public java.lang.String getGroup()
Group name, this caheItem is to be included in

Returns:
Group Name

getSubGroup

public java.lang.String getSubGroup()
SubGroup name, this caheItem is to be included in

Returns:
SubGroup name

getVersion

public CacheItemVersion getVersion()
Item version of the object, used when getCachItem is used on Cache

Returns:
See Also:
Cache

getQueryInfo

public java.util.HashMap getQueryInfo()
Deprecated. 

Internal use only

Returns:

getTags

public Tag[] getTags()
gets all tags this CacheItem is attached to

Returns:
Array of tags

Clone

public java.lang.Object Clone()
If dependency or ItemUpdateCallbacks are used in this cacheItem then it is a shallow copy, else this clone method observes a deep clone

Returns:
CacheItem as an Object

setAbsoluteExpiration

public void setAbsoluteExpiration(java.util.Date absoluteExpiration)
Sets the time at which the added object expires and is removed from the cache.

Parameters:
absoluteExpiration - Sets the time at which the added object expires and is removed from the cache.

setQueryInfo

public void setQueryInfo(java.util.HashMap queryInfo)
Deprecated. 

Internal use only

Parameters:
queryInfo -

setTags

public void setTags(Tag[] tags)
sets all tags this CacheItem is to be attached to

Parameters:
tags - Array of tag names, cannot contain null

setDependency

public void setDependency(CacheDependency dependency)
Parameters:
dependency - Sets the CacheDependency of this Item.

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

See Also:
CacheDependency

setCacheSyncDependency

public void setCacheSyncDependency(CacheSyncDependency syncDependency)
The 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.

Parameters:
syncDependency - instance of CacheSyncDependency
See Also:
CacheSyncDependency

setPriority

public void setPriority(CacheItemPriority priority)
Parameters:
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.
See Also:
CacheItemPriority

setPriority

public void setPriority(int p)
Set priority using integer value

Parameters:
p -
See Also:
CacheItemPriority

setResyncExpiredItems

public void setResyncExpiredItems(boolean resync)
Parameters:
resync - Sets a value indicating whether the object when expired will cause a re-fetch of the object from the master datasource. (Resync Expired Items).

setSlidingExpiration

public void setSlidingExpiration(TimeSpan slidingExpiration)
Parameters:
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.

setValue

public void setValue(java.lang.Object value)
Parameters:
value - Sets the value of the CacheItem.

setFlag

public void setFlag(Alachisoft.NCache.Common.BitSet Flag)
Deprecated. 

Internal use only

Parameters:
Flag -

getItemRemoveCallback

public CacheItemRemovedCallback getItemRemoveCallback()
An instance 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.

Returns:
instance of the callback
See Also:
CacheItemRemovedCallback

setItemRemoveCallback

public void setItemRemoveCallback(CacheItemRemovedCallback itemRemoveCallback)
An instance 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.

Parameters:
itemRemoveCallback - instance of the callback
See Also:
CacheItemRemovedCallback

getItemUpdateCallback

public CacheItemUpdatedCallback getItemUpdateCallback()
An instance 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.

Returns:
instance of the callback
See Also:
CacheItemUpdatedCallback

setItemUpdateCallback

public void setItemUpdateCallback(CacheItemUpdatedCallback itemUpdateCallback)
An instance 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.

Parameters:
itemUpdateCallback -
See Also:
CacheItemUpdatedCallback

getAsyncItemAddedCallback

public AsyncItemAddedCallback getAsyncItemAddedCallback()
An instance 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.

Returns:
instance of the callback
See Also:
AsyncItemAddedCallback

setAsyncItemAddedCallback

public void setAsyncItemAddedCallback(AsyncItemAddedCallback itemAddedCallback)
An instance 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.

Parameters:
itemAddedCallback -
See Also:
AsyncItemAddedCallback

getAsyncItemUpdatedCallback

public AsyncItemUpdatedCallback getAsyncItemUpdatedCallback()
An instance 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.

Returns:
instance of the callback
See Also:
AsyncItemUpdatedCallback

setAsyncItemUpdatedCallback

public void setAsyncItemUpdatedCallback(AsyncItemUpdatedCallback itemUpdatedCallback)
An instance 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.

Parameters:
itemUpdatedCallback -
See Also:
AsyncItemUpdatedCallback

setGroup

public void setGroup(java.lang.String group)
The name of the group to associate with the cache item. All cache items with the same group name are logically grouped together.

Parameters:
group - string, cannot be null of subgroup is existent

setSubGroup

public void setSubGroup(java.lang.String subGroup)
The name of the sub-group within a group. This hierarchical grouping gives more control over the cache items.

Parameters:
subGroup - string, cannot be null if group is existent

setVersion

public void setVersion(CacheItemVersion version)
Sets Item Version

Parameters:
version -

setNamedTags

public void setNamedTags(NamedTagsDictionary namedTags)
Parameters:
namedTags - Sets the value of the named tags

getNamedTags

public NamedTagsDictionary getNamedTags()
Returns:
NamedTagsDictionary associated with CacheItem

setResyncProviderName

public void setResyncProviderName(java.lang.String resyncProviderName)
Parameters:
resyncProviderName - provider used for re-synchronization of item

getResyncProviderName

public java.lang.String getResyncProviderName()
Returns:
provider used for re-synchronization of item

getCreationTime

public java.util.Date getCreationTime()
Deprecated. 

Internal use only

Returns:

getLastModifiedTime

public java.util.Date getLastModifiedTime()
Deprecated. 

internal use only

Returns:

setCreationTime

public void setCreationTime(java.util.Date _creationTime)
Deprecated. 

Internal Use only

Parameters:
_creationTime -

setLastModifiedTime

public void setLastModifiedTime(java.util.Date _lastModifiedTime)
Deprecated. 

Internal use only

Parameters:
_lastModifiedTime -