|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.opencms.flex.cache.CmsFlexCacheEntry
Contains the contents of a cached resource.
It is basically a list of pre-generated output, include() calls to other resources (with request parameters) and http headers that this resource requires to be set.
A CmsFlexCacheEntry might also describe a redirect-call, but in this case nothing else will be cached.
The pre-generated output is saved in byte[] arrays.
The include() calls are saved as Strings of the included resource name,
the parameters for the calls are saved in a HashMap.
The headers are saved in a HashMap.
In case of a redirect, the redircet target is cached in a String.
The CmsFlexCacheEntry can also have a timeout value, which indicates the time that his entry will become invalid and should thus be cleared from the cache.
I_CmsFlexLruCacheObject| Field Summary | |
static int |
C_INITIAL_CAPACITY_LISTS
Initial size for lists |
| Constructor Summary | |
CmsFlexCacheEntry()
Constructor for class CmsFlexCacheEntry. |
|
| Method Summary | |
void |
add(byte[] bytes)
Adds an array of bytes to this cache entry, this will usually be the result of some kind of output - stream. |
void |
add(String resource,
Map paramters)
Add an include - call target resource to this cache entry. |
void |
addHeaders(Map headers)
Add a map of headers to this cache entry, which are usually collected in the class CmsFlexResponse first. |
void |
addToLruCache()
Invoked after an object was added to the cache. |
void |
complete()
Completes this cache entry. |
List |
elements()
Returns the list of data entries of this cache entry. |
protected void |
finalize()
Finalize this instance. |
int |
getLruCacheCosts()
Returns the cache costs of this object, as for example it's byte size. |
I_CmsFlexLruCacheObject |
getNextLruObject()
Returns the next object in the double linked list of all cached objects. |
I_CmsFlexLruCacheObject |
getPreviousLruObject()
Returns the previous object in the double linked list of all cached objects. |
long |
getTimeout()
Returns the timeout - value of this cache entry, this is set to the time when the entry becomes invalid. |
void |
removeFromLruCache()
Invoked after the object was removed to the cache. |
void |
service(CmsFlexRequest req,
CmsFlexResponse res)
Processing method for this cached entry. |
void |
setNextLruObject(I_CmsFlexLruCacheObject theNextEntry)
Set the next object in the double linked list of all cached objects. |
void |
setPreviousLruObject(I_CmsFlexLruCacheObject thePreviousEntry)
Set the previous object in the double linked list of all cached objects. |
void |
setRedirect(String target)
Set a redirect target for this cache entry. |
void |
setTimeout(long timeout)
Sets a timeout value to this cache entry, which indicates the time this entry becomes invalid. |
void |
setVariationData(String theVariationKey,
Map theVariationMap)
Stores a backward reference to the map and key where this cache entry is stored. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int C_INITIAL_CAPACITY_LISTS
| Constructor Detail |
public CmsFlexCacheEntry()
The way to use this class is to first use this empty constructor and later add data with the various add methods.
| Method Detail |
public void add(byte[] bytes)
bytes - the output to save in the cache
public void add(String resource,
Map paramters)
resource - a name of a resource in the OpenCms VFSpublic void addHeaders(Map headers)
headers - the map of headers to add to the entrypublic void setRedirect(String target)
Important: When a redirect target is set, all saved data is thrown away, and new data will not be saved in the cache entry. This is so since with a redirect nothing will be displayed in the browser anyway, so there is no point in saving the data.
target - The redirect target (must be a valid URL).public List elements()
Data entries are byte arrays representing some kind of ouput or Strings representing include calls to other resources.
public void service(CmsFlexRequest req,
CmsFlexResponse res)
throws CmsException,
javax.servlet.ServletException,
IOException
If this method is called, it delivers the contents of the cached entry to the given request / response. This includes calls to all included resources.
req - the request from the clientres - the server response
CmsException - is thrown when problems writing to the response output-stream occur
ServletException - might be thrown from call to RequestDispatcher.include()
IOException - might be thrown from call to RequestDispatcher.include() or from Response.sendRedirect()public long getTimeout()
public void setTimeout(long timeout)
The timeout parameter represents the minute - intervall in which the cache entry is to be cleared. The intervall always starts at 0.00h. A value of 60 would indicate that this entry will reach it's timeout at the beginning of the next full hour, a timeout of 20 would indicate that the entry is invalidated at x.00, x.20 and x.40 of every hour etc.
timeout - the timeout value to be setpublic void complete()
A completed cache entry is made "unmodifiable", so that no further data can be added and existing data can not be changed. This is to prevend the (unlikley) case that some user-written class tries to make changes to a cache entry.
public String toString()
toString in class ObjectObject.toString()
public void setVariationData(String theVariationKey,
Map theVariationMap)
theVariationKey - the variation keytheVariationMap - the variation mappublic void setNextLruObject(I_CmsFlexLruCacheObject theNextEntry)
I_CmsFlexLruCacheObject
setNextLruObject in interface I_CmsFlexLruCacheObjecttheNextEntry - the next objectI_CmsFlexLruCacheObject.setNextLruObject(com.opencms.flex.util.I_CmsFlexLruCacheObject)public I_CmsFlexLruCacheObject getNextLruObject()
I_CmsFlexLruCacheObject
getNextLruObject in interface I_CmsFlexLruCacheObjectI_CmsFlexLruCacheObject.getNextLruObject()public void setPreviousLruObject(I_CmsFlexLruCacheObject thePreviousEntry)
I_CmsFlexLruCacheObject
setPreviousLruObject in interface I_CmsFlexLruCacheObjectthePreviousEntry - the previous objectI_CmsFlexLruCacheObject.setPreviousLruObject(com.opencms.flex.util.I_CmsFlexLruCacheObject)public I_CmsFlexLruCacheObject getPreviousLruObject()
I_CmsFlexLruCacheObject
getPreviousLruObject in interface I_CmsFlexLruCacheObjectI_CmsFlexLruCacheObject.getPreviousLruObject()public void addToLruCache()
I_CmsFlexLruCacheObject
addToLruCache in interface I_CmsFlexLruCacheObjectI_CmsFlexLruCacheObject.addToLruCache()public void removeFromLruCache()
I_CmsFlexLruCacheObject
removeFromLruCache in interface I_CmsFlexLruCacheObjectI_CmsFlexLruCacheObject.removeFromLruCache()public int getLruCacheCosts()
I_CmsFlexLruCacheObject
getLruCacheCosts in interface I_CmsFlexLruCacheObjectI_CmsFlexLruCacheObject.getLruCacheCosts()
protected void finalize()
throws Throwable
finalize in class ObjectThrowableObject.finalize()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||