Hi list

The Caching TT2 does for templates is great.  What I'm interested in doing, however, 
is to add an additional layer of caching on top of it, which caches the final output 
of template + data.  This way, as long as neither the data nor the template are out of 
date, i can just hand them the final document rather than munging the data from the 
database and running it through the template.  The problem I have is there's no easy 
way for an external script that uses the toolkit to know when any given piece of a 
cached template is out of date.  Sure, I can check the Date Modified of the template, 
but that doesn't tell me what other files that that template may use for 
template-fragments/wrappers etc, and if they're up to date.

I know quite well that processing a cached template is not the prime culprit for slow 
page delivery when serving up content from a database.  however checking 
staleness+dumping content from a file to the requester does in my mind seem to be a 
clear improvement to running a significant amount of perl code to generate the 
template output each time.

In general i'm looking for this

- compile data munged from db/other sources to an intermediate (perl) format so it's 
ready to be dumped into a template
- compile template to intermediate form (the toolkit already does this for me)
- compile the two to the final format and store it in a finalized form for quick 
delivery

so that

1 - if both data and template are up to date, just serve the finalized form
2 - if the data is out of date, but the template is not, recompile the data to the 
intermediate form and let the toolkit use the cached verion of the template
3 - if the template is out of date but the data is not, dump the cached data into 
toolkit, which will recompile the template for me.
4 - if neither are up to date, recompile the data to the intermediate form and let the 
toolkit recompile the template for me.


This is all quite simple, and I really don't have to do any work to get the caching on 
TT2's end of things.  But it's really a matter of knowing when (1) can occur.

What's a good way to find out if all the pieces of the template are up to date?  I 
don't mind walking through a list of Date Modifieds for each file, but I need a way to 
get that list without changing TT2 internals, as I'd like to be able to keep using TT2 
as an easily upgradeable black box.

-Stephen


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates

Reply via email to