jatanp
jatanp

Reputation: 4092

How to store compiled Freemarker Templates

We have just started playing with Freemarker as UI template engine and the POC results are quite satisfactory and looks like we would start using it as our de facto UI processing framework instead of JSP.

The real benefit we see here we can store Freemarker templates anywhere (e.g. jar files, file system directories, even database for that matter !).

During POC, we did not see much performance issue but I was thinking if the templates can be pre-compiled and stored in file system / database for faster response on first hit or whenever there is a compiled cache-miss for a given template.

Is it possible to get hold of binary structure (most probably it would be multi-node tree) of a compiled Template and serialize in file and vice-versa.

Thanks in advance.

Upvotes: 0

Views: 1168

Answers (1)

ddekany
ddekany

Reputation: 31132

No, there's no such feature in FreeMarker (the AST had to be made serializable). OTOH first-time parsing shouldn't be slow unless you have a lot of templates and/or huge templates. By not slow I mean it's nothing like compiling JSP-s or Java which you can really "feel" when it first loads. Is there an actual performance problem, or it's just precaution?

Upvotes: 1

Related Questions