Java Mailing List Archive

http://www.junlu.com/

Home » FreeMarker-user »

Re: [FreeMarker-user] Removing templates manually from a cache.

Frank Zeyda

2011-12-15

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi Daniel,

Many thanks for such a quick reply and fix.

> BTW the whole delay business has a design issue... it should be
> per-template-loader. After all, what the ideal delay depends on how
> resource consuming checking if the source was changed is.

Yes, I agree. The delayed loading mechanism, for instance, does not equally
make sense for all template loaders. So each loader should ideally be able to
specify its own caching policy.

> So, I just wonder of a 0 delay for the StringTemplateLoader and non-0 for the
> FileTemplateLoader would solve your problem. Anyway, you can't do that...

Yes, I suppose it would if this was possible.

> You are supposed use the CacheStorage API only indirectly, trough the
> Configuration API. Or at least I suppose that was the intent of the
> authors.

I see. I think that despite the above there is still the possibility of
providing custom cache implementations at the user's end, so maybe for this
reason the design was chosen.

> Can you get the TemplateCache instance at all? There's no
> Configuration.getTemplateCache, nor setTemplateCache. I think the only
> reason TemplateCache is public is that access control in Java is
> overly simplistic for any product that has sub-packages.

Ah, actually Configuration has a method void setCacheStorage(CacheStorage). So
by creating and setting one's own cache, it is possible to get a reference to
it!

> Anyway... I have added Configuration.removeTemlateFromCache to the 2.3
> branch. Tell me if it works. Here's the build:
> ...

Great. Many thanks once more for looking at this so quickly!

I checked out the svn sources to find out the signature of the method. It seems
work without problems.

PS: It would be nice to commit this branch to the maven repository to some
point; I could then download it dynamically as part of my build process. For now
I am using the attached freemarker.jar.

All the best,
Frank


------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.
But none more important than the need to reduce IT complexity
while improving strategic productivity. Learn More!
http://www.accelacomm.com/jaw/sdnl/114/51507609/
_______________________________________________
FreeMarker-user mailing list
FreeMarker-user@(protected)
https://lists.sourceforge.net/lists/listinfo/freemarker-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.