public abstract class AbstractCacheManager extends Object implements ICacheManager
Common abstract class for ICacheManager implementations, useful
for taking care of the lazy initialization of cache objects when their
corresponding getXCache() methods are called.
Note a class with this name existed since 2.0.0, but it was completely reimplemented in Thymeleaf 3.0
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCacheManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearAllCaches()
Clears all the caches managed by this cache manager instance.
|
List<String> |
getAllSpecificCacheNames()
Returns a list with the names of all the specific caches
managed by this implementation.
|
ICache<ExpressionCacheKey,Object> |
getExpressionCache()
Returns the cache of expression evaluation artifacts.
|
<K,V> ICache<K,V> |
getSpecificCache(String name)
Returns a specific (non-default) cache, by its name.
|
ICache<TemplateCacheKey,TemplateModel> |
getTemplateCache()
Returns the cache of parsed templates.
|
protected abstract ICache<ExpressionCacheKey,Object> |
initializeExpressionCache() |
protected abstract ICache<TemplateCacheKey,TemplateModel> |
initializeTemplateCache() |
public final ICache<TemplateCacheKey,TemplateModel> getTemplateCache()
ICacheManager
Returns the cache of parsed templates. Keys are the template names,
as specified at the TemplateEngine.process(String, org.thymeleaf.context.IContext)
method.
getTemplateCache in interface ICacheManagerpublic final ICache<ExpressionCacheKey,Object> getExpressionCache()
ICacheManagerReturns the cache of expression evaluation artifacts.
This cache is meant to store artifacts of diverse nature needed along the process of parsing and executing expressions in the several languages available: Standard expressions, OGNL expressions, Spring EL expressions...
Parsing these expressions usually results in some kind of syntax tree object that represents the expression, and this is what this cache usually stores.
Keys are the expressions themselves (their String representation), along with a type that is normally used for identifying the nature of the object being cached (for example {"ognl","person.name"}).
getExpressionCache in interface ICacheManagerpublic <K,V> ICache<K,V> getSpecificCache(String name)
ICacheManagerReturns a specific (non-default) cache, by its name.
User-defined dialects might make use of additional caches (besides template, and expression) defined at custom-made implementations of this interface, and they should use this method to retrieve them by their name.
Note the default StandardCacheManager will return null for every
call to this method, as it should be custom implementations of this interface (or
extensions of AbstractCacheManager or extensions StandardCacheManager)
who implement these specific caches and offer their names through the
ICacheManager.getAllSpecificCacheNames() method.
getSpecificCache in interface ICacheManagerK - the type of the cache keysV - the type of the cache valuesname - the name of the needed cachepublic List<String> getAllSpecificCacheNames()
ICacheManagerReturns a list with the names of all the specific caches managed by this implementation.
Might return null if no specific caches are managed.
Note the default StandardCacheManager will return null, as it should
be custom implementations of this interface (or
extensions of AbstractCacheManager or extensions StandardCacheManager)
who implement these specific caches and offer their names through the
ICacheManager.getAllSpecificCacheNames() method.
getAllSpecificCacheNames in interface ICacheManagerpublic void clearAllCaches()
ICacheManagerClears all the caches managed by this cache manager instance.
This method is mainly intended for use from external tools that might need to clean all caches completely, without having to worry about implementation details.
clearAllCaches in interface ICacheManagerprotected abstract ICache<TemplateCacheKey,TemplateModel> initializeTemplateCache()
protected abstract ICache<ExpressionCacheKey,Object> initializeExpressionCache()
Copyright © 2017 The THYMELEAF team. All rights reserved.