Re: Question on TemplateCache synchronization

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On 2008.04.13., at 12:38, Daniel Dekany wrote:
> Saturday, April 12, 2008, 11:45:27 AM, Attila Szegedi wrote:
>
>> Well, I probably wouldn't touch TemplateLoader as such --  
>> surprisingly
>> many people have written their own custom loaders. TemplateCache can
>> provide a reader-to-string "slurping" transformation internally.
>> Actually, if I were to write a new loader API, what I'd do primarily
>> is merge the timestamp lookup and retrival, so it's REST friendly,
>> i.e. remote retrieval over HTTP can be implemented with a single GET
>> operation using If-Modified-Since header etc.
>
> Yes. Currently I use a single myproject.VirtualFile object as the
> return value from the "loader", which can includes the whole content
> of the file (maybe a char[], maybe a byte[], depending on if the
> storage is a "binary" storage or a "natively" textual storage), and
> all kind of meta-info like last modification, expiration date (!) if
> available, user-friendly (informal) location description, even MIME
> type and charset if the storage stores that (some of them does), etc.
> Not, not really... in fact I don't use last modification date, but a
> more generic "version stamp". For most storages it's indeed just the
> modification date, but for some a serial number, for others it may
> also contains the length or hash of the file... much more flexible
> than a last modification date.

HTTP specification has the concept of "Entity tags" (quite underused  
AFAIK, except in WebDAV):
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11

>
>> it's not something that'd
>> be inherently hard, the hardness comes from java.lang.String's
>> (justified) immutability requirements *and* lack of immutable arrays
>> in Java...
>
> Yeah, no immutable arrays! And why? Somebody please tell me... That's
> in my not-very-short list of most annoying things in Java.

Mine too.

Attila.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
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.