public interface MustacheEngine
Configuration
and template cache. Implementation must be
thread-safe.Modifier and Type | Field and Description |
---|---|
static String |
COMPUTING_CACHE_CONSUMER_ID |
Modifier and Type | Method and Description |
---|---|
Mustache |
compileMustache(String templateContent)
Compile the given template.
|
Mustache |
compileMustache(String name,
String templateContent)
Compile the given template.
|
Configuration |
getConfiguration() |
Mustache |
getMustache(String name)
Get the compiled template with the given id.
|
String |
getMustacheSource(String name) |
void |
invalidateTemplateCache()
Invalidate all the cache entries for both compiled and uncompiled templates.
|
void |
invalidateTemplateCache(Predicate<String> predicate)
Invalidate the cache entries whose template name is matching the given predicate.
|
static final String COMPUTING_CACHE_CONSUMER_ID
ComputingCache
Mustache getMustache(String name)
This method involves all template locators to locate the template contents. Locators with higher priority are called first.
By default the compiled template is automatically put into the template cache so that no compilation happens the next time the template is requested.
name
- The template identifiernull
if
no such template existsMustache.getName()
,
TemplateLocator
,
EngineConfigurationKey.TEMPLATE_CACHE_ENABLED
,
EngineConfigurationKey.TEMPLATE_CACHE_EXPIRATION_TIMEOUT
String getMustacheSource(String name)
name
- Mustache.getName()
Mustache compileMustache(String name, String templateContent)
name
- The template identifiertemplateContent
- Mustache compileMustache(String templateContent)
Mustache.getName()
is generated automatically.templateContent
- Configuration getConfiguration()
void invalidateTemplateCache()
invalidateTemplateCache(Predicate)
void invalidateTemplateCache(Predicate<String> predicate)
predicate
- invalidateTemplateCache()
Copyright © 2017. All rights reserved.