Well, I managed to extend DefaultMustacheFactory and implement all I needed but it was a little bit tricky. Overriding
getReader method was not a problem. To enable the refresh functionality I had to override
compile(String name) method, have own mustacheCache and also extend
MustacheParser and place it in the same package where my extened MustacheFactory resides (as I wrote MustacheParser constructor is protected).
I think it would be great to allow the extending factory to provide its own Guava CacheBuilder (expiration, maximum size, etc.)... Maybe some protected method like this:
protected CacheBuilder provideCacheBuilder() { // return defaults}And also make
mustacheCache attribute protected so that extending factory could manage the cache (invalidating entries, etc.).
Thanks Sam
Martin
Dne úterý, 7. srpna 2012 22:55:39 UTC+2 Sam napsal(a):