|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.nucleus.TimedOperationService atg.nucleus.servlet.ServletService atg.nucleus.servlet.HttpServletService atg.servlet.DynamoServlet atg.droplet.Cache
public class Cache
This droplet caches the contents of its oparam named output. It improves performance for pages that generate dynamic content which is the same for all users, or where there are a small number of versions of the content (for example, one version for members and another for guests).
If your request is rewriting URLs to include the session id, the session id and request id will be removed from the cached content. This prevents session ids from being returned to incorrect users. If you know that the contents of your oparam do not define any URLs and you want to improve the performance of this case by avoiding the search for session ids, you can specify the parameter hasNoURLs to "true".
Your cached content will periodically be regenerated the first request after a specified time interval has elapsed since the content was cached. You can specify what this interval should be with the request parameter cacheCheckSeconds. If no cacheCheckSeconds parameter is supplied, the content is expired using the bean property defaultCacheCheckSeconds on the cache droplet itself.
It is possible to have more than one view of the cached data associated with each cache droplet invocation. For example, if your page had different views for members and non-members, you can still use the cache droplet. To do this, set the key request parameter to contain the a value that uniquely identifies the content of the page. In the above example, we'd set the key parameter to "true" for members and "false" for non-members. The cache droplet maintains separate cached content for each value of the key parameter. You do not need to supply system wide unique key values. Each cache droplet gets its own name space of key values.
All content managed by a single cache droplet instance is periodically purged based on the property purgeCacheSeconds (the default is every 6 hours). This is to retrieve data storage for instances of the cache droplet that are no longer in use. This would happen if you remove or recompile a jhtml page that has a cache droplet.
If you visit the admin page for this component in the component browser, you can see statistics about the content which is cached.
The Cache component itself is a JMS message sink. When it receives a message, it flushes any content that it may define. You can use multiple instance of the Cache servlet bean if you would like to control which content gets flushed for a JMS message.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
static java.lang.String |
DO_NOT_CACHE_RESPONSE
|
static java.lang.String |
PROTOCOL_CHANGE_DROPLET
|
Fields inherited from class atg.servlet.DynamoServlet |
---|
mAllowCleanupRequest, mParameters |
Fields inherited from class atg.nucleus.servlet.ServletService |
---|
SERVLET_INFO_KEY |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
Cache()
|
Method Summary | |
---|---|
protected javax.servlet.Servlet |
createAdminServlet()
Creates and returns a new Servlet that will administer this service. |
java.lang.String |
ensureNoIds(DynamoHttpServletRequest pRequest,
java.lang.String cacheData)
|
void |
flushCache()
Forces cache to flush the data. |
char[] |
getCachedContent(DynamoHttpServletRequest pRequest)
Returns the cached content for the given request. |
int |
getDefaultCacheCheckSeconds()
|
boolean |
getEnabled()
|
atg.servlet.pagecompile.PageEncodingTyper |
getEncodingTyper()
|
long |
getPurgeCacheSeconds()
|
java.lang.String |
getSessionURLName()
The name for the session id. |
void |
init(javax.servlet.ServletConfig pConfig)
Initializes the servlet. |
boolean |
isCachingEnabled(DynamoHttpServletRequest pRequest)
If this returns false, then the droplet should proceed as if no caching is involved at all. |
void |
receiveMessage(java.lang.String pPortName,
javax.jms.Message pMessage)
Called by DMS when a Message arrives through the given input port. |
void |
removeCachedElement(java.lang.String key)
|
void |
service(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Determine whether we have a valid cached entry. |
void |
setCachedContent(DynamoHttpServletRequest pRequest,
char[] pContent)
Sets the cached content for the given request. |
void |
setDefaultCacheCheckSeconds(int pCheckCacheSeconds)
This property specifies the default time interval for invalidating cached content if the droplet does not receive the request parameter cacheCheckSeconds. |
void |
setEnabled(boolean pEnabled)
Sets the property Enabled. |
void |
setEncodingTyper(atg.servlet.pagecompile.PageEncodingTyper pEncodingTyper)
Sets the property EncodingTyper. |
void |
setPurgeCacheSeconds(long pPurgeCacheSeconds)
This property specifies the default time interval for purging the entire collection of cached content. |
void |
setSessionURLName(java.lang.String pSessionURLName)
The name for the session id. |
Methods inherited from class atg.servlet.DynamoServlet |
---|
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter |
Methods inherited from class atg.nucleus.servlet.ServletService |
---|
destroy, getServletConfig, getServletInfo, setServletInfo |
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final java.lang.String DO_NOT_CACHE_RESPONSE
public static final java.lang.String PROTOCOL_CHANGE_DROPLET
Constructor Detail |
---|
public Cache()
Method Detail |
---|
public void setSessionURLName(java.lang.String pSessionURLName)
public java.lang.String getSessionURLName()
public void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
service
in class DynamoServlet
pRequest
- the request to be processedpResponse
- the response object for this request
javax.servlet.ServletException
- an application specific error occurred
processing this request
java.io.IOException
- an error occurred reading data from the request
or writing data to the response.public java.lang.String ensureNoIds(DynamoHttpServletRequest pRequest, java.lang.String cacheData)
public void removeCachedElement(java.lang.String key)
public void setDefaultCacheCheckSeconds(int pCheckCacheSeconds)
public int getDefaultCacheCheckSeconds()
public void setPurgeCacheSeconds(long pPurgeCacheSeconds)
public long getPurgeCacheSeconds()
public void setEnabled(boolean pEnabled)
public boolean getEnabled()
public void flushCache()
public void receiveMessage(java.lang.String pPortName, javax.jms.Message pMessage) throws javax.jms.JMSException
receiveMessage
in interface MessageSink
javax.jms.JMSException
- if there is a problem processing the
messagepublic void setEncodingTyper(atg.servlet.pagecompile.PageEncodingTyper pEncodingTyper)
public atg.servlet.pagecompile.PageEncodingTyper getEncodingTyper()
protected javax.servlet.Servlet createAdminServlet()
createAdminServlet
in class GenericService
public boolean isCachingEnabled(DynamoHttpServletRequest pRequest)
public char[] getCachedContent(DynamoHttpServletRequest pRequest)
public void setCachedContent(DynamoHttpServletRequest pRequest, char[] pContent)
public void init(javax.servlet.ServletConfig pConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class ServletService
pServletConfig
- servlet configuration information
javax.servlet.ServletException
- if a servlet exception has occurred
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |