com.ibm.websphere.servlet.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. |
java.util.Enumeration |
getDataIds()
This gets all ids (cache ids and data ids) that this entry
depends on for invalidation. |
long |
getExpirationTime()
This is the absolute time when the entry should expire. |
java.lang.String |
getId()
The unique identifier of this cached entry. |
int |
getPriority()
A larger priority gives an entry a longer time in the
cache when it is not being used. |
int |
getSharingPolicy()
In a multi-JVM environment, this indicates whether the cache entry
should be EntryInfo.NOT_SHARED, EntryInfo.SHARED_PULL or
EntryInfo.SHARED_PUSH. |
java.util.Enumeration |
getTemplates()
This gets all templates that this entry depends on for invalidation. |
int |
getTimeLimit()
This is 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. |
byte[] |
getValue()
The entry's value (i.e., the object that is cached). |
int |
hashCode()
This overrides the method in Object. |
void |
refreshEntry()
Mimics a cache Hit, refreshing an entries spot in the LRU algorithm. |
getTemplates
public 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.
- 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
public 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
public long getTimeStamp()
- This implements the method in the InvalidationEvent interface.
- Returns:
- The creation timestamp.
equals
public boolean equals(java.lang.Object object)
- This overrides the method in Object.
It compares cache ids.
- Overrides:
equals
in class java.lang.Object
- Returns:
- A true indicates they are equal.
hashCode
public 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.
getTimeLimit
public int getTimeLimit()
- This is 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.
- Parameters:
The
- time limit.
getExpirationTime
public long getExpirationTime()
- This is 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
public int getPriority()
- A larger priority gives an entry a longer time in the
cache when it is not being used.
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
public int getSharingPolicy()
- In a multi-JVM environment, this indicates whether the cache entry
should be EntryInfo.NOT_SHARED, EntryInfo.SHARED_PULL or
EntryInfo.SHARED_PUSH. The default is SHARED_PULL.
- Returns:
- The sharing policy.
getId
public java.lang.String getId()
- 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 lruArray to know how to find it in the entryHashtable.
- Returns:
- The String id of this Cache Entry.
getValue
public byte[] getValue()
- The entry's value (i.e., the object that is cached).
refreshEntry
public void refreshEntry()
- Mimics a cache Hit, refreshing an entries spot in the LRU algorithm.
- Returns:
- The creation timestamp.