Class ConcurrentMapTemplateCache

  • All Implemented Interfaces:
    TemplateCache

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

      • ConcurrentMapTemplateCache

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

      • 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 java.io.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:
        java.io.IOException - If input can't be parsed.