I tried storing templates in the database and it worked out well.
I abandoned it for business reasons.
Basically in the init of each servlet I pulled the templates and
compiled them. The only down side was that I did not have any
means to update the compiled template. I was playing with a
trigger sending a message to the application and setting a
application variable. When the servlet is called it checks this
variable to see if the template has changed. I never got the
listener part working, but it should work.
----- Original Message -----
From: "Mike Orr" <iron@...>
Sent: Thursday, April 25, 2002 7:46 PM
Subject: Re: Re: [Webware-discuss] MVC and Servlets
> On Fri, Apr 26, 2002 at 12:59:17AM +0200, Ernesto Revilla
> > > That's
> > > t = Template(templateDef, searchList=[orderData])
> > > to you, buddy. :)
> > >
> > > It's prob'ly possible with some work to store the
> > > template module in the database and then exec it into a
> > > dictionary when you need it, but it's prob'ly easier to
> > > store the template definition in the databse and let it be
> > > recompiled each time.
> > How much does this cost? (I'm thinking of systems with about
> Nobody's tried it, so I have no idea. Theoretically, it would
> CPU cycles over storing uncompiled template definitions in the
> If you want to try it, let us know on
> cheetahtemplate-discuss@... how it goes, or
if you run
> into any snags. Then when you have a working strategy, we'll
put it in
> the documentation for future users.
> Your servlet could have a cache of recently-used template
> (or classes) stored in a module variable, keyed by the database
> Then if a certain template is used frequently, it wouldn't have
> pulled from the database (and possibly compiled) each time.
> Just be sure not to let two threads share the same template
> the same time. (It's OK to share template classes.) We
> codified the thread safety of template instances.
> -Mike (Iron) Orr, iron@... (if mail problems:
> http://iron.cx/ English * Esperanto * Russkiy * Deutsch
> Webware-discuss mailing list