Hi Florin,
Yes, it's safe to reuse a DefaultMustacheFactory. The only difference
between reusing one and using a freshly created one is that a
DefaultMustacheFactory caches the templates it's already compiled,
assuming you compiled them using the "compile(name)" method.
In the projects where I've used Mustache I have a helper method to
provide a MustacheFactory. In production it provides the same
instance every time. In development it provides a fresh instance
every time, because I want to be able to alter the template and see
the changes without restarting the application.
It looks like you're manually caching the compiled templates. This is
probably necessary because you're using the "compile(reader, name)"
method instead of the "compile(name)" one. If you could somehow
rework it to use the single parameter version instead you could get
rid of all that custom caching in your code, I believe. Is there a
reason such a refactoring is not possible?
-Michael
> --
> You received this message because you are subscribed to the Google Groups
> "mustache.java" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
mustachejava...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>