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.

-Aaron


----- Original Message -----
From: "Mike Orr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
wrote:
> > > That's
> > > t = Template(templateDef, searchList=[orderData])
> > > to you, buddy.  :)
> > >
> > > It's prob'ly possible with some work to store the
precompiled
> > > template module in the database and then exec it into a
private
> > > dictionary when you need it, but it's prob'ly easier to
just
> > > 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
20-50 users)
>
> Nobody's tried it, so I have no idea.  Theoretically, it would
save some
> CPU cycles over storing uncompiled template definitions in the
database.
>
> If you want to try it, let us know on
> [EMAIL PROTECTED] 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
instances
> (or classes) stored in a module variable, keyed by the database
ID.
> Then if a certain template is used frequently, it wouldn't have
to be
> pulled from the database (and possibly compiled) each time.
>
> Just be sure not to let two threads share the same template
instance at
> the same time.  (It's OK to share template classes.)  We
haven't fully
> codified the thread safety of template instances.
>
> --
> -Mike (Iron) Orr, [EMAIL PROTECTED]  (if mail problems:
[EMAIL PROTECTED])
>    http://iron.cx/     English * Esperanto * Russkiy * Deutsch
* Espan~ol
>
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>


_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to