public class BroadleafCacheProcessor
extends org.thymeleaf.processor.attr.AbstractAttrProcessor
TemplateCacheKeyResolverService to build the actual cacheKey used by the underlying
caching implementation. The parameter named "cacheKey" will be used in the construction of the actual cacheKey
which may rely on variables like the customer, site, theme, etc. to build the actual cacheKey.
The "cacheTimeout" variable defines the maximum length of time that the fragment will be allowed to be cached. This
is important for fragments for which a good cacheKey would be difficult to generate.
The cacheKey resolution is pluggable using an instance of TemplateCacheKeyResolverService which will be
invoked by this. The default implementation is SimpleCacheKeyResolver.
Implementors can create more functional cacheKey mechanisms. For example, Broadleaf Enterprise provides an
additional implementation named EnterpriseCacheKeyResolver with support for additional caching
features.| Modifier and Type | Field and Description |
|---|---|
static String |
ATTR_NAME |
protected net.sf.ehcache.Cache |
cache |
protected TemplateCacheKeyResolverService |
cacheKeyResolver |
protected SystemPropertiesService |
systemPropertiesService |
| Constructor and Description |
|---|
BroadleafCacheProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkCacheForElement(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
If this template was found in cache, adds the response to the element and returns true.
|
protected boolean |
checkExpired(org.thymeleaf.dom.Element element,
net.sf.ehcache.Element cacheElement)
Returns true if the item has been
|
void |
fixElement(org.thymeleaf.dom.Element element,
org.thymeleaf.Arguments arguments) |
net.sf.ehcache.Cache |
getCache() |
protected String |
getFragmentSignatureUnprefixedAttributeName(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element,
String attributeName,
String attributeValue) |
int |
getPrecedence() |
boolean |
isCachingEnabled() |
org.thymeleaf.processor.ProcessorResult |
processAttribute(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element,
String attributeName) |
void |
setCache(net.sf.ehcache.Cache cache) |
protected boolean |
shouldCache(org.thymeleaf.Arguments args,
org.thymeleaf.dom.Element element,
String attributeName) |
doProcess, getMatcherpublic static final String ATTR_NAME
protected net.sf.ehcache.Cache cache
protected SystemPropertiesService systemPropertiesService
protected TemplateCacheKeyResolverService cacheKeyResolver
public void fixElement(org.thymeleaf.dom.Element element,
org.thymeleaf.Arguments arguments)
protected boolean shouldCache(org.thymeleaf.Arguments args,
org.thymeleaf.dom.Element element,
String attributeName)
public org.thymeleaf.processor.ProcessorResult processAttribute(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element,
String attributeName)
processAttribute in class org.thymeleaf.processor.attr.AbstractAttrProcessorprotected boolean checkCacheForElement(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
arguments - element - protected boolean checkExpired(org.thymeleaf.dom.Element element,
net.sf.ehcache.Element cacheElement)
element - cacheElement - protected String getFragmentSignatureUnprefixedAttributeName(org.thymeleaf.Arguments arguments, org.thymeleaf.dom.Element element, String attributeName, String attributeValue)
public int getPrecedence()
getPrecedence in class org.thymeleaf.processor.AbstractProcessorpublic net.sf.ehcache.Cache getCache()
public void setCache(net.sf.ehcache.Cache cache)
public boolean isCachingEnabled()
Copyright © 2014. All Rights Reserved.