Problem on Freemarker Template Cache?
"Lihui Pang" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
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.
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=/