Class ConcurrentMapTemplateCache

java.lang.Object
com.github.jknack.handlebars.cache.ConcurrentMapTemplateCache
All Implemented Interfaces:
TemplateCache

public class ConcurrentMapTemplateCache extends Object implements TemplateCache
A simple TemplateCache built on top of ConcurrentHashMap.
Since:
0.1.0
  • Constructor Details

    • ConcurrentMapTemplateCache

      public ConcurrentMapTemplateCache()
      Creates a new ConcurrentMapTemplateCache.
  • Method Details

    • clear

      public void clear()
      Description copied from interface: TemplateCache
      Remove all mappings from the cache.
      Specified by:
      clear in interface TemplateCache
    • evict

      public void evict(TemplateSource source)
      Description copied from interface: TemplateCache
      Evict the mapping for this source from this cache if it is present.
      Specified by:
      evict in interface TemplateCache
      Parameters:
      source - the source whose mapping is to be removed from the cache
    • get

      public Template get(TemplateSource source, Parser parser) throws IOException
      Description copied from interface: TemplateCache
      Return the value to which this cache maps the specified key.
      Specified by:
      get in interface TemplateCache
      Parameters:
      source - source whose associated template is to be returned.
      parser - The Handlebars parser.
      Returns:
      A template.
      Throws:
      IOException - If input can't be parsed.
    • setReload

      public ConcurrentMapTemplateCache setReload(boolean reload)
      Description copied from interface: TemplateCache
      Turn on/off auto reloading of templates. Auto reload is done using TemplateSource.lastModified().
      Specified by:
      setReload in interface TemplateCache
      Parameters:
      reload - True, for turning off template reload. Default is: false.
      Returns:
      This template loader.