public void invalidateCache() {
   Log.debug("Invalidating Mustache cache");
   mustacheCache.invalidateAll();
   lambdaCache.invalidateAll();
 }
Пример #2
-1
  private Mustache compileIfChanged(String filename, boolean partial) {
    Mustache template = mustacheCache.getIfPresent(filename);

    if (template == null) {

      String desc = partial ? "partial" : "template";
      Log.debug("Compiling Mustache " + desc, "name", filename);

      Res res = getResource(filename, partial);
      template = customCompile(filename, res);

      res.onChange(
              "mustache",
              new Runnable() {
                @Override
                public void run() {
                  invalidateCache();
                }
              })
          .trackChanges();

      mustacheCache.put(filename, template);
    }

    return template;
  }