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

Reply via email to