Class MarkupTemplateEngine.CachingTemplateResolver

java.lang.Object
groovy.text.markup.MarkupTemplateEngine.DefaultTemplateResolver
groovy.text.markup.MarkupTemplateEngine.CachingTemplateResolver
All Implemented Interfaces:
TemplateResolver
Enclosing class:
MarkupTemplateEngine

public static class MarkupTemplateEngine.CachingTemplateResolver extends MarkupTemplateEngine.DefaultTemplateResolver
A template resolver which avoids calling ClassLoader.getResource(String) if a template path already has been queried before. This improves performance if caching is enabled in the configuration.
  • Field Details

    • cache

      protected final Map<String,URL> cache
    • useCache

      protected boolean useCache
  • Constructor Details

    • CachingTemplateResolver

      public CachingTemplateResolver(Map<String,URL> cache)
      Creates a new caching template resolver. The cache implementation being used depends on the use of the template engine. If multiple templates can be rendered in parallel, it must be using a thread-safe cache.
      Parameters:
      cache - the backing cache
    • CachingTemplateResolver

      public CachingTemplateResolver()
      Creates a new caching template resolver using a concurrent hash map as the backing cache.
  • Method Details