|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
com.opensymphony.oscache.web.tag.CacheTag
public class CacheTag
CacheTag is a tag that allows for server-side caching of post-processed JSP content.
It also gives great programatic control over refreshing, flushing and updating the cache.
Usage Example:
<%@ taglib uri="oscache" prefix="cache" %>
<cache:cache key="mycache"
scope="application"
refresh="false"
time="30">
jsp content here... refreshed every 30 seconds
</cache:cache>
Field Summary |
---|
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
CacheTag()
|
Method Summary | |
---|---|
int |
doAfterBody()
After the cache body, either update the cache, serve new cached content or indicate an error. |
void |
doCatch(Throwable throwable)
|
int |
doEndTag()
The end tag - clean up variables used. |
void |
doFinally()
|
int |
doStartTag()
The start of the tag. |
void |
setCron(String cron)
Sets the cron expression that should be used to expire content at specific dates and/or times. |
void |
setDuration(String duration)
Set the time this cache entry will be cached for. |
void |
setGroups(String groups)
Sets the groups for this cache entry. |
void |
setKey(String key)
Set the key for this cache entry. |
void |
setLanguage(String language)
Set the ISO-639 language code to distinguish different pages in application scope |
void |
setMode(String mode)
Setting this to true prevents the cache from writing any output
to the response, however the JSP content is still cached as normal. |
void |
setRefresh(boolean refresh)
This method allows the user to programatically decide whether the cached content should be refreshed immediately. |
void |
setRefreshpolicyclass(String refreshPolicyClass)
Class used to handle the refresh policy logic |
void |
setRefreshpolicyparam(String refreshPolicyParam)
Parameters that will be passed to the init method of the refresh policy instance. |
void |
setScope(String scope)
Set the scope of this cache. |
void |
setTime(int time)
Set the time this cache entry will be cached for (in seconds) |
void |
setUseBody(boolean useBody)
This controls whether or not the body of the tag is evaluated or used. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
---|
getParent, setPageContext, setParent |
Constructor Detail |
---|
public CacheTag()
Method Detail |
---|
public void setDuration(String duration)
duration
- The duration to cache this content (using either the simple
or the ISO-8601 format). Passing in a duration of zero will turn off the
caching, while a negative value will result in the cached content never
expiring (ie, the cached content will always be served as long as it is
present).public void setCron(String cron)
public void setGroups(String groups)
groups
- A comma-delimited list of groups that the cache entry belongs to.public void setKey(String key)
key
- The key for this cache entry.public void setLanguage(String language)
language
- The language code for this cache entry.public void setRefresh(boolean refresh)
refresh
- Whether or not to refresh this cache entry immediately.public void setMode(String mode)
true
prevents the cache from writing any output
to the response, however the JSP content is still cached as normal.
mode
- The cache mode to use.public void setRefreshpolicyclass(String refreshPolicyClass)
public void setRefreshpolicyparam(String refreshPolicyParam)
public void setScope(String scope)
scope
- The scope of this cache. Either "application" (default) or "session".public void setTime(int time)
time
- The time to cache this content (in seconds). Passing in
a time of zero will turn off the caching. A negative value for the
time will result in the cached content never expiring (ie, the cached
content will always be served if it is present)public void setUseBody(boolean useBody)
It is most often called by the <UseCached /> tag to tell this tag to use the cached content.
useBody
- Whether or not to use the cached content.UseCachedTag
public int doAfterBody() throws JspTagException
doAfterBody
in interface IterationTag
doAfterBody
in class BodyTagSupport
JspTagException
- The standard exception thrown.public void doCatch(Throwable throwable) throws Throwable
doCatch
in interface TryCatchFinally
Throwable
public int doEndTag() throws JspTagException
doEndTag
in interface Tag
doEndTag
in class BodyTagSupport
JspTagException
- The standard exception thrown.public void doFinally()
doFinally
in interface TryCatchFinally
public int doStartTag() throws JspTagException
Grabs the administrator, the cache, the specific cache entry, then decides whether to refresh.
If no refresh is needed, this serves the cached content directly.
doStartTag
in interface Tag
doStartTag
in class BodyTagSupport
JspTagException
- The standard exception thrown.
|
OSCache Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |