@Override public Mustache compile(String name) { Mustache mustache = mustacheCache.computeIfAbsent(name, getMustacheCacheFunction()); mustache.init(); return mustache; }
public Mustache compile(Reader reader, String file, String sm, String em) { Mustache compile = mc.compile(reader, file, sm, em); compile.init(); partialCache.remove(); return compile; }
public Mustache getFragment(FragmentKey templateKey) { Mustache mustache = templateCache.computeIfAbsent(templateKey, getFragmentCacheFunction()); mustache.init(); return mustache; }
/** * In order to handle recursion, we need a temporary thread local cache during compilation * that is ultimately thrown away after the top level partial is complete. * * @param s the name of the partial to compile * @return the compiled partial */ public Mustache compilePartial(String s) { final Map<String, Mustache> cache = partialCache.get(); final Mustache cached = cache.get(s); if (cached != null) { // Our implementation supports this but I // don't think it makes sense in the interface if (cached instanceof DefaultMustache) { ((DefaultMustache)cached).setRecursive(); } return cached; } try { final Mustache mustache = mc.compile(s); cache.put(s, mustache); mustache.init(); return mustache; } finally { cache.remove(s); } }
@Override protected Function<String, Mustache> getMustacheCacheFunction() { return (template) -> { Mustache compile = mp.compile(template); compile.init(); return compile; }; } };
public Mustache getFragment(FragmentKey templateKey) { Mustache mustache = templateCache.computeIfAbsent(templateKey, getFragmentCacheFunction()); mustache.init(); return mustache; }
public Mustache compile(Reader reader, String file, String sm, String em) { Mustache compile = mc.compile(reader, file, sm, em); compile.init(); partialCache.remove(); return compile; }
public Mustache getFragment(FragmentKey templateKey) { Mustache mustache = templateCache.computeIfAbsent(templateKey, getFragmentCacheFunction()); mustache.init(); return mustache; }
@Override public Mustache compile(String name) { Mustache mustache = mustacheCache.computeIfAbsent(name, getMustacheCacheFunction()); mustache.init(); return mustache; }
@Override public Mustache compile(String name) { Mustache mustache = mustacheCache.computeIfAbsent(name, getMustacheCacheFunction()); mustache.init(); return mustache; }
public Mustache compile(Reader reader, String file, String sm, String em) { Mustache compile = mc.compile(reader, file, sm, em); compile.init(); partialCache.remove(); return compile; }
/** * In order to handle recursion, we need a temporary thread local cache during compilation * that is ultimately thrown away after the top level partial is complete. * * @param s the name of the partial to compile * @return the compiled partial */ public Mustache compilePartial(String s) { final Map<String, Mustache> cache = partialCache.get(); final Mustache cached = cache.get(s); if (cached != null) { // Our implementation supports this but I // don't think it makes sense in the interface if (cached instanceof DefaultMustache) { ((DefaultMustache)cached).setRecursive(); } return cached; } try { final Mustache mustache = mc.compile(s); cache.put(s, mustache); mustache.init(); return mustache; } finally { cache.remove(s); } }
/** * In order to handle recursion, we need a temporary thread local cache during compilation * that is ultimately thrown away after the top level partial is complete. * * @param s the name of the partial to compile * @return the compiled partial */ public Mustache compilePartial(String s) { final Map<String, Mustache> cache = partialCache.get(); final Mustache cached = cache.get(s); if (cached != null) { // Our implementation supports this but I // don't think it makes sense in the interface if (cached instanceof DefaultMustache) { ((DefaultMustache)cached).setRecursive(); } return cached; } try { final Mustache mustache = mc.compile(s); cache.put(s, mustache); mustache.init(); return mustache; } finally { cache.remove(s); } }
public Mustache compile(String name) { if (config.cache_templates) { return super.compile(name); } try { Mustache mustache = mc.compile(name); mustache.init(); return mustache; } catch (UncheckedExecutionException e) { throw handle(e); } }