com.ibm.websphere.cache

Interface CacheEntry


  1. 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.

Field Summary

Modifier and Type Field and Description
  1. static
  2. int
CACHE_TYPE_DEFAULT
Default type of a cache entry.
  1. static
  2. int
CACHE_TYPE_JAXRPC
This type of cache entry is is used internally by Dynamic Cache for when caching webservices.

Method Summary

Modifier and Type Method and Description
  1. boolean
equals(java.lang.Object object)
the default equals method.
  1. void
finish()
Call the finish() method when you no longer need this CacheEntry.
  1. java.util.Enumeration
getAliasList()
Returns the alias list.
  1. int
getCacheType()
Returns the type of CacheEntry (CACHE_TYPE_DEFAULT or CACHE_TYPE_JAXRPC) ALL implementors of this method other than Dynacache should return CACHE_TYPE_DEFAULT for this method.
  1. long
getCacheValueSize()
Returns the best-effort size of the cache entry's value.
  1. long
getCreationTime()
Returns the time of the entry was first created.
  1. java.util.Enumeration
getDataIds()
Returns all IDs (cache IDs and data IDs) that this entry depends on for invalidation.
  1. byte[]
getDisplayValue()
Returns the entry's value in a displayable format.
  1. long
getExpirationTime()
Returns the absolute time when the entry should expire.
  1. java.lang.String
getExternalCacheGroupId()
Returns the ExternalCacheGroup name this the cache entry belongs too.
  1. java.lang.String
getId()
Returns the unique identifier of this cached entry.
  1. java.lang.Object
getIdObject()
This method gets the unique identifier of this cached entry.
  1. int
getPriority()
Returns the priority of this cache entry, which determines how long the entry will stay in cache when it is not being used.
  1. int
getSharingPolicy()
Returns the sharing policy of this entry.
  1. java.util.Enumeration
getTemplates()
Returns all templates that this entry depends on for invalidation.
  1. int
getTimeLimit()
Returns the maximum interval of time in seconds that the entry is allowed to stay in the cache.
  1. long
getTimeStamp()
Returns the creation time of this entry.
  1. java.lang.Object
getUserMetaData()
Returns the user metadata.
  1. long
getValidatorExpirationTime()
Returns the validator expiration time of the entry in the cache The validator expiration time along with the expiration time control the state of the entry in the cache.
  1. java.lang.Object
getValue()
Returns the entry's value.
  1. int
hashCode()
the default hashcode method of the cache entry.
  1. boolean
isBatchEnabled()
Deprecated. The updates for Push or Push-Pull sharing policies are always done in an asynchronous batch mode. It always returns true.
  1. boolean
isInvalid()
Is this entry an invalid entry?
  1. boolean
prepareForSerialization()
This method will be called before serialization of the CacheEntry.
  1. void
refreshEntry()
This mimics a cache Hit, refreshing an entries spot in the replacement algorithm.
  1. java.lang.String
toString()
default implementation of CacheEntry

Field Detail

CACHE_TYPE_DEFAULT

  1. static final int CACHE_TYPE_DEFAULT
Default type of a cache entry. All cache provider entries are of this type.
See Also:

CACHE_TYPE_JAXRPC

  1. static final int CACHE_TYPE_JAXRPC
This type of cache entry is is used internally by Dynamic Cache for when caching webservices. Not to be used by cache providers.
See Also:

Method Detail

getTemplates

  1. java.util.Enumeration getTemplates( )
Returns all templates that this entry depends on for invalidation. For a JSP/servlet, a template is the URI for this entry.
  • For a top-level entry (eg, a JSP/Servlet that is externally requested), this is obtained from the HTTP request object's URL. It can be set either by the server or by the top-level JSP/Servlet.
  • For a contained entry, this is the JSP/Servlet file name URL (the parameter that would be used in the callPage method). It can be set either by the JSP/Servlet it names or its containing JSP/Servlet, plus other information from the request object.
Returns:
An Enumeration of the templates.

getDataIds

  1. java.util.Enumeration getDataIds( )
Returns 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

  1. long getTimeStamp()
Returns the creation time of this entry.
Returns:
The creation timestamp.

equals

  1. boolean equals(java.lang.Object object)
the default equals method. It compares cache IDs.
Overrides:
equals in class java.lang.Object
Returns:
True if they are equal.

hashCode

  1. int hashCode()
the default hashcode method of the cache entry.
Overrides:
hashCode in class java.lang.Object
Returns:
The hashCode of the cache ID.

getTimeLimit

  1. int getTimeLimit()
Returns 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

  1. long getExpirationTime()
Returns 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

  1. int getPriority()
Returns 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

  1. int getSharingPolicy()
Returns 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

  1. boolean isBatchEnabled()
Deprecated. The updates for Push or Push-Pull sharing policies are always done in an asynchronous batch mode. It always returns true.
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

  1. java.lang.String getId()
Returns 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 CacheEntry.

getValue

  1. java.lang.Object getValue()
Returns the entry's value.
Returns:
The enrty's value.

getDisplayValue

  1. byte[] getDisplayValue()
Returns the entry's value in a displayable format.
Returns:
The entry's value.

refreshEntry

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

getAliasList

  1. java.util.Enumeration getAliasList( )
Returns the alias list.
Returns:
The alias list.

getUserMetaData

  1. java.lang.Object getUserMetaData( )
Returns the user metadata.
Returns:
The user metadata.

finish

  1. 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

  1. long getCacheValueSize()
Returns 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;

isInvalid

  1. boolean isInvalid()
Is this entry an invalid entry? An invalid entry is like a zombie i.e. the entry's age is beyond its validator expiration time and before its real expiration time. Returns false if the validator expiration time was not set on the CacheEntry. Returns true if the validator expiration time < current time < real expiration time.
Returns:
boolean to indicate the entry invalid or not.

getCreationTime

  1. long getCreationTime()
Returns the time of the entry was first created.

getIdObject

  1. java.lang.Object getIdObject()
This method gets the unique identifier of this cached entry. It must be unique within the scope of a Cache Instance
Returns:
The Object representation of the ID of this Cache Entry.

getCacheType

  1. int getCacheType()
Returns the type of CacheEntry (CACHE_TYPE_DEFAULT or CACHE_TYPE_JAXRPC) ALL implementors of this method other than Dynacache should return CACHE_TYPE_DEFAULT for this method.
Returns:
cache type

getValidatorExpirationTime

  1. long getValidatorExpirationTime( )
Returns the validator expiration time of the entry in the cache The validator expiration time along with the expiration time control the state of the entry in the cache.
Returns:
long the current validator expiration time in milliseconds

prepareForSerialization

  1. boolean prepareForSerialization( )
This method will be called before serialization of the CacheEntry. The implementor of this method returns a boolean if this CacheEntry for some reason cannot be serialized
Returns:
true - The value was serialized false - The value can not be serialized.

toString

  1. java.lang.String toString()
default implementation of CacheEntry
Overrides:
toString in class java.lang.Object
Returns:
The string representation of the cache entry.

getExternalCacheGroupId

  1. java.lang.String getExternalCacheGroupId( )
Returns the ExternalCacheGroup name this the cache entry belongs too.
Returns:
null of this cache entry is not cached externally