Re: loading plain files

"Attila Szegedi" <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On Sun, Nov 16, 2008 at 8:50 PM, Luther Baker <[email protected]> wrote:

> I ended up simply looking up the file myself as a resource. I really
> like the header suggestion ... I cache the contents in memory but your
> http header suggestion even helps with the bandwidth as well.
>
> A quick question on using Freemarker again ... I could easily start
> and end the file with a <#noparse> block. For instance - I want to
> load JQuery.js. I've no idea what they include in their distros ...
> but I can easily add the noparse directive to the top and bottom of
> the files they distribute.
>
> Would that be ok?


I think yes.


> Would I be safe in assuming that Freemarker would only read that file
> one time?


Yes. Actually, if you're using soft caching (which is the default -- look
into various CacheStorage implementations if you need i.e. strong caching),
JVM can sweep the template out of the memory if it's not used for a while
and it decides it can use the memory for something else to improve
performance. It'll then be reloaded when requested later. I usually go with
this as it lets caching be memory sensitive and results in better overall
system throughput.


> And that for the most part, the noparse directive would
> speed up how it is served everytime?


No. It'd somewhat speed up the one-time loading. A block of text with no
FreeMarker-recognized markup in it will internally end up being a single
char[] whether in a <#noparse> or not. <#noparse> will just make sure no
content is accidentally recognized as markup during template loading.

Attila.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.