com.ibm.websphere.cache
Interface CacheEntry


public interface CacheEntry

A CacheEntry is a struct object that holds the cache id and value, as well as metadata for caching. The information in these variables is obtained from the EntryInfo object used when the entry was cached.


Method Summary
 boolean equals(java.lang.Object object)
          This overrides the method in Object.
 void finish()
          Call the finish() method when you no longer need this CacheEntry.
 java.util.Enumeration getAliasList()
          This gets the alias list.
 long getCacheValueSize()
          This determines the best-effort size of the cache entry's value.
 java.util.Enumeration getDataIds()
          This gets all ids (cache ids and data ids) that this entry depends on for invalidation.
 byte[] getDisplayValue()
          This gets the entry's value in a displayable format.
 long getExpirationTime()
          This gets the absolute time when the entry should expire.
 java.lang.String getId()
          This gets the unique identifier of this cached entry.
 int getPriority()
          This gets the priority of this cache entry, which determines how long the entry will stay in cache when it is not being used.
 int getSharingPolicy()
          This gets the sharing policy of this entry.
 java.util.Enumeration getTemplates()
          This gets all templates that this entry depends on for invalidation.
 int getTimeLimit()
          This gets the maximum interval of time in seconds that the entry is allowed to stay in the cache.
 long getTimeStamp()
          This implements the method in the InvalidationEvent interface.
 java.lang.Object getUserMetaData()
          Get's the user metadata
 java.lang.Object getValue()
          This gets the entry's value.
 int hashCode()
          This overrides the method in Object.
 boolean isBatchEnabled()
          In a multi-JVM environment, this indicates whether updates to the cache entry (when using EntryInfo.SHARED_PUSH) will be written out immediately or in a batched, asynchronous fashion.
 void refreshEntry()
          This mimics a cache Hit, refreshing an entries spot in the replacement algorithm.
 java.lang.String toString()
          This converts the cache entry to a string.
 

Method Detail

getTemplates

java.util.Enumeration getTemplates()
This gets all templates that this entry depends on for invalidation. For a JSP/servlet, a template is the URI for this entry.

Returns:
An Enumeration of the templates.

getDataIds

java.util.Enumeration getDataIds()
This gets all ids (cache ids and data ids) that this entry depends on for invalidation. Its elements are Strings. They are the identifiers used in the invalidateById methods to invalidate all cache entries having a dependency on these ids. Data ids must be unique within the same scope as cache ids.

Returns:
An Enumeration of the ids.

getTimeStamp

long getTimeStamp()
This implements the method in the InvalidationEvent interface.

Returns:
The creation timestamp.

equals

boolean equals(java.lang.Object object)
This overrides the method in Object. It compares cache ids.

Overrides:
equals in class java.lang.Object
Returns:
True if they are equal.

hashCode

int hashCode()
This overrides the method in Object. It returns the hashCode of the cache id.

Overrides:
hashCode in class java.lang.Object
Returns:
The hashCode of the cache id.

getTimeLimit

int getTimeLimit()
This gets the maximum interval of time in seconds that the entry is allowed to stay in the cache. The entry may be discarded via LRU replacement prior to this time. A negative value indicates no time limit.

Returns:
The time limit.

getExpirationTime

long getExpirationTime()
This gets the absolute time when the entry should expire. The entry may be discarded via LRU replacement prior to this time. A negative value indicates no expiration time.

Returns:
The expiration time.

getPriority

int getPriority()
This gets the priority of this cache entry, which determines how long the entry will stay in cache when it is not being used. A larger priority gives an entry a longer time in the cache. The value of priority should be based on the ratio of the cost of computing the entry to the cost of the memory in the cache (the size of the entry). The default is 1.

Returns:
This entry's priority.

getSharingPolicy

int getSharingPolicy()
This gets the sharing policy of this entry. In a multi-JVM environment, this indicates whether the cache entry should be EntryInfo.NOT_SHARED, EntryInfo.SHARED_PUSH_PULL or EntryInfo.SHARED_PUSH. The default is NOT_SHARED.

Returns:
The sharing policy.

isBatchEnabled

boolean isBatchEnabled()
In a multi-JVM environment, this indicates whether updates to the cache entry (when using EntryInfo.SHARED_PUSH) will be written out immediately or in a batched, asynchronous fashion.

Returns:
True if batch is enabled, false otherwise.

getId

java.lang.String getId()
This gets the unique identifier of this cached entry. It must be unique within the scope of the group of Cache instances. Having this in the CacheEntry allows an entry obtained via the LRU array to know how to find it in the entryHashtable.

Returns:
The String id of this Cache Entry.

getValue

java.lang.Object getValue()
This gets the entry's value.

Returns:
The enrty's value.

getDisplayValue

byte[] getDisplayValue()
This gets the entry's value in a displayable format.

Returns:
The entry's value.

refreshEntry

void refreshEntry()
This mimics a cache Hit, refreshing an entries spot in the replacement algorithm.


getAliasList

java.util.Enumeration getAliasList()
This gets the alias list.

Returns:
The alias list.

getUserMetaData

java.lang.Object getUserMetaData()
Get's the user metadata


finish

void finish()
Call the finish() method when you no longer need this CacheEntry. This will allow any NIO buffers to be released when the CacheEntry is removed from cache.


getCacheValueSize

long getCacheValueSize()
This determines the best-effort size of the cache entry's value.

Returns:
The best-effort determination of the size of the cache entry's value. If the size cannot be determined, the return value is -1;

toString

java.lang.String toString()
This converts the cache entry to a string.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of the cache entry.