Common interface for all cache manager implementations.
This class is in charge of providing the corresponding cache objects to the template engine. Every call to each of the getXCache() methods must always return the XCache object (i.e. only one cache object should be ever created for each type of cache, and returned every time it is requested).
Four caches are predefined:
- A template cache, used for storing parsed templates referenced by their template name.
- A fragment cache, used for storing the parsed DOM tree correspondence of fragments: pieces of template code that need to be parsed before being added to the template tree, like for example messages coming from .properties files with HTML tags that are included in results using th:utext processors.
- A message cache, used for storing messages (usually from internationalization files) referenced by template name and locale (like "home_gl_ES").
- An expression cache, used for storing expression evaluation artifacts (for example, {@link org.thymeleaf.standard.expression.Expression} parsed trees,OGNL/Spring EL parsed trees, etc). Given that this cache can usually store objects of different classes (referenced by their String representation), prefixes are normally applied to the String keys in order to being able to differentiate these differente classes when retrieving cache entries.
Only these four caches are needed by the template engine when the standard dialects are being used, but users might want to define new dialects and use new types of caches, which can be provided by the cache manager using the {@link #getSpecificCache(String)}method.
Any of these methods could return null, in which case the engine will consider that no cache must be applied for that specific function.
@author Daniel Fernández
@since 2.0.0