Re: Problem on Freemarker Template Cache?
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Friday, July 18, 2008, 6:40:32 PM, Lihui Pang wrote:
> Hi,
>
> I use Freekmarker and the templates are cached. When I run my unit
> test, the template can be found in the cache. However when I run
> integration test, the template can NOT be found in the cache except
> one case - the cfg.getTemplate() is called right after another call
> with the same template name.
>
> The cfg.getTemplate() is called in my test methods. I notice that the
> unit test method takes very short time, so each time the template can
> be found in the cache; however my integration test method takes a
> little long time. At this time the template can't be found in the
> cache. Except one method has two getTemplate() calls with the same
> name.
>
> Looks like the template is removed from the cache. I don't know if
> it's expired then removed from cache, or it's removed by JVM.
So, you get the *same* template for multiple times during the
integration test, right? In that case, at least 50 templates should
always remain cached (given that you have used "strong: 50" below).
Are you absolutely sure the slowdown is related to the cache?
> Here it's my configuration defination:
>
> private static Configuration cfg = new Configuration();
>
> static {
> try {
> cfg.setSetting(Configuration.CACHE_STORAGE_KEY, "strong:50, soft:250");
> cfg.setObjectWrapper(ObjectWrapper.BEANS_WRAPPER);
> cfg.setClassForTemplateLoading(cfg.getClass(), "/ftl");
> cfg.setTemplateUpdateDelay(3000);
> }catch(Exception e){
> e.printStackTrace();
> }
> }
>
>
> Thanks a lot for your help.
>
> (Sorry if you see this message twice),
>
> -------------------------------------------------------------------------
> 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
--
Best regards,
Daniel Dekany
-------------------------------------------------------------------------
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=/