com.opensymphony.oscache.web.tag
public class: UseCachedTag [javadoc |
source]
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
com.opensymphony.oscache.web.tag.UseCachedTag
All Implemented Interfaces:
IterationTag, Serializable
UseCachedTag is a tag that tells a <cache> tag to reuse the cached body.
Usage Example:
<%@ taglib uri="oscache" prefix="cache" %>
<cache:cache key="mycache" scope="application">
if (reuse cached)
<cache:usecached />
else
some other logic
</cache:cache>
Note this is very useful with try / catch blocks
so that you can still produce old cached data if an
exception occurs, eg your database goes down.
- author:
< - a href="mailto:mike@atlassian.com">Mike Cannon-Brookes
- version:
$ - Revision: 254 $
| Field Summary |
|---|
| boolean | use | |
| Method from com.opensymphony.oscache.web.tag.UseCachedTag Summary: |
|---|
|
doStartTag, setUse |
| Methods from javax.servlet.jsp.tagext.TagSupport: |
|---|
|
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
| Method from com.opensymphony.oscache.web.tag.UseCachedTag Detail: |
public int doStartTag() throws JspTagException {
CacheTag cacheTag = (CacheTag) TagSupport.findAncestorWithClass(this, CacheTag.class);
if (cacheTag == null) {
throw new JspTagException("A UseCached tag must be nested within a Cache tag");
}
cacheTag.setUseBody(!use);
return SKIP_BODY;
}
|
public void setUse(boolean value) {
this.use = value;
}
Set the decision to use the body content of the ancestor <cache> or not. |