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

public class GuavaTemplateCache extends Object implements com.github.jknack.handlebars.cache.TemplateCache
An implementation of TemplateCache built on top of Guava. If setReload(boolean) is on we recommended one of the available auto-eviction policy of Guava, it helps to reduce leaks when auto-reload is on.
Since:
0.11.0
Author:
edgar.espina
  • Constructor Summary

    Constructors
    Constructor
    Description
    GuavaTemplateCache(com.google.common.cache.Cache<com.github.jknack.handlebars.io.TemplateSource,com.github.jknack.handlebars.Template> cache)
    Creates a new GuavaTemplateCache.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    evict(com.github.jknack.handlebars.io.TemplateSource source)
     
    com.github.jknack.handlebars.Template
    get(com.github.jknack.handlebars.io.TemplateSource source, com.github.jknack.handlebars.Parser parser)
     
    setReload(boolean reload)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GuavaTemplateCache

      public GuavaTemplateCache(com.google.common.cache.Cache<com.github.jknack.handlebars.io.TemplateSource,com.github.jknack.handlebars.Template> cache)
      Creates a new GuavaTemplateCache.
      Parameters:
      cache - The guava cache to use. Required.
  • Method Details

    • clear

      public void clear()
      Specified by:
      clear in interface com.github.jknack.handlebars.cache.TemplateCache
    • evict

      public void evict(com.github.jknack.handlebars.io.TemplateSource source)
      Specified by:
      evict in interface com.github.jknack.handlebars.cache.TemplateCache
    • get

      public com.github.jknack.handlebars.Template get(com.github.jknack.handlebars.io.TemplateSource source, com.github.jknack.handlebars.Parser parser) throws IOException
      Specified by:
      get in interface com.github.jknack.handlebars.cache.TemplateCache
      Throws:
      IOException
    • setReload

      public GuavaTemplateCache setReload(boolean reload)
      Specified by:
      setReload in interface com.github.jknack.handlebars.cache.TemplateCache