| java.lang.Object com.caucho.portal.generic.Cache
Cache | abstract public class Cache (Code) | | |
Field Summary | |
final protected static Logger | log |
Method Summary | |
abstract public void | finishCaching(Writer writer, int expirationCache, CacheKey cacheKey, String encoding, Map<String, Object> cachePropertiesMap, Map<String, Object> propertiesMap, Map<String, String> requestAttributeMap) Finish with a Writer previously returned by
Cache.startCachingWriter . | abstract public void | finishCaching(OutputStream outputStream, int expirationCache, CacheKey cacheKey, Map<String, Object> cachePropertiesMap, Map<String, Object> propertiesMap, Map<String, String> requestAttributeMap) Finish with an OutputStream previously returned by
Cache.startCachingOutputStream . | abstract public OutputStream | getCachingOutputStream(String namespace, int expirationCache, boolean isPrivate) Called immediately before a Portlet is rendered to give the Cache
an opportunity to cache the response.
If the response can be cached, the implementation returns an OutputStream
that receives the response.
When the response is completed, finishCaching(OutputStream) will be called.
If the response cannot be cached, the implementation returns null.
At this point, the expirationCache is a best guess and the real value
passed to finishCaching() may be different.
Parameters: window - the portlet window for the portlet about tobe rendered Parameters: namespace - the namespace for the portlet about to be rendered Parameters: expirationCache - a best guess at the expiration period in seconds, -1 if unlimited an OutputStream that intercepts the content and then writes toresponse.getOutputStream(), or null if the response cannot be cached. | abstract public Writer | getCachingWriter(String namespace, int expirationCache, boolean isPrivate) Called to give the Cache an opportunity to cache the response.
If the response can be cached, the implementation returns a Writer
that receives the response.
When the response is completed, finishCaching(Writer) will be called.
If the response cannot be cached, the implementation returns null.
At this point, the expirationCache is a best guess and the real value
passed to finishCaching() may be different.
Parameters: window - the portlet configuration for the portlet about tobe rendered Parameters: namespace - the namespace for the portlet about to be rendered Parameters: expirationCache - a best guess at the expiration period in seconds, -1 if unlimited a Writer that intercepts the content and then writes toresponse.getWriter(), or null if the response cannot be cached. | abstract public int | respondFromCache(CacheKey cacheKey, RenderRequest request, RenderResponse response) Send a response from the cache, or return false if there is no
response from the cache.
The passed cacheKey can be manipulated by the cache without side-effects,
but the cache cannot take ownership of the cacheKey because it may be
pooled by the caller.
Binary responses should be sent to the OutputStream obtained with
response.getOutputStream().
Textual response should be sent to the PrintWriter obtained with
response.getWriter().
response.setCharacterEncoding() should be used before getWriter()
to set the character encoding to the character encoding that was in
use when the response was cached.
If isPrivate is true, then cacheKey.getRequestedSessionId() will have a
non-null value. |
finishCaching | abstract public void finishCaching(Writer writer, int expirationCache, CacheKey cacheKey, String encoding, Map<String, Object> cachePropertiesMap, Map<String, Object> propertiesMap, Map<String, String> requestAttributeMap)(Code) | | Finish with a Writer previously returned by
Cache.startCachingWriter . If the expirationCache is 0 or the cacheKey is
null, the cached response must be discarded.
Parameters: writer - the writer returned from Cache.startCachingWriter Parameters: expirationCache - the updated expirationCache, this may the samevalue received in Cache.startWriter, a new value set bythe portlet while it rendered itself, or 0 if the cache must bediscarded. Parameters: cacheKey - the CacheKey that uniquely differentiates this response from other responses Parameters: encoding - the encoding for the Writer, the cache needs to callresponse.setEncoding(encoding) if it later responds in respondFromCache(). Parameters: cachePropertiesMap - a map of properties that begin with "Cache-",these may be directives to the cache or may be keys and values that shoulddistinguish the uniqueness of the Cached value beyond the uniquenessestablished by CacheKey, depending on the portal implementation. These properties should be recreated during respondFromCache().If the value is a String, setProperty is used. If the value isan ArrayList, add property is used. Parameters: propertiesMap - a map of properties that the Cache must recreatewhen the cached response is used in a susbsequent call to respondFromCacheIf the value is a String, setProperty is used. If the value isan ArrayList, add property is used. Parameters: requestAttributesMap - a map of request attributes that the Cachemust recreate when the cached response is used in a susbsequent call torespondFromCache |
getCachingOutputStream | abstract public OutputStream getCachingOutputStream(String namespace, int expirationCache, boolean isPrivate) throws IOException(Code) | | Called immediately before a Portlet is rendered to give the Cache
an opportunity to cache the response.
If the response can be cached, the implementation returns an OutputStream
that receives the response.
When the response is completed, finishCaching(OutputStream) will be called.
If the response cannot be cached, the implementation returns null.
At this point, the expirationCache is a best guess and the real value
passed to finishCaching() may be different.
Parameters: window - the portlet window for the portlet about tobe rendered Parameters: namespace - the namespace for the portlet about to be rendered Parameters: expirationCache - a best guess at the expiration period in seconds, -1 if unlimited an OutputStream that intercepts the content and then writes toresponse.getOutputStream(), or null if the response cannot be cached. |
getCachingWriter | abstract public Writer getCachingWriter(String namespace, int expirationCache, boolean isPrivate) throws IOException(Code) | | Called to give the Cache an opportunity to cache the response.
If the response can be cached, the implementation returns a Writer
that receives the response.
When the response is completed, finishCaching(Writer) will be called.
If the response cannot be cached, the implementation returns null.
At this point, the expirationCache is a best guess and the real value
passed to finishCaching() may be different.
Parameters: window - the portlet configuration for the portlet about tobe rendered Parameters: namespace - the namespace for the portlet about to be rendered Parameters: expirationCache - a best guess at the expiration period in seconds, -1 if unlimited a Writer that intercepts the content and then writes toresponse.getWriter(), or null if the response cannot be cached. |
respondFromCache | abstract public int respondFromCache(CacheKey cacheKey, RenderRequest request, RenderResponse response)(Code) | | Send a response from the cache, or return false if there is no
response from the cache.
The passed cacheKey can be manipulated by the cache without side-effects,
but the cache cannot take ownership of the cacheKey because it may be
pooled by the caller.
Binary responses should be sent to the OutputStream obtained with
response.getOutputStream().
Textual response should be sent to the PrintWriter obtained with
response.getWriter().
response.setCharacterEncoding() should be used before getWriter()
to set the character encoding to the character encoding that was in
use when the response was cached.
If isPrivate is true, then cacheKey.getRequestedSessionId() will have a
non-null value.
A cache should first perform a lookup with the CacheKey as provided.
If that fails, it should call cacheKey.setLocale(null) and try again.
The cache should also check the value of cacheKey.getContentType().
If the contentType is null, the cache can respond if it has an entry
that matches for one contentType. If a match is found, the cache
sets the contentType with connection.setContentType().
0 if no response was written from the cache, otherwise the number of seconds that a response written from the cache is good for or -1if the cached reponse is good forever |
|
|