[Zope-CMF] RAM Cache and CMF objects?

Dan L. Pierson dan@control.com
Tue, 26 Mar 2002 11:23:26 -0500


--On Friday, March 22, 2002 08:56:36 PM +0100 Dieter Maurer 
<dieter@handshake.de> wrote:

> seb bacon writes:
>  > > I can't imagine ever wanting to use RAM caching for full pages;  you
>  > > are "robbing Peter to pay Paul" there, inevitably.  Instead, we are
>  > > focusing heavily on improving our interactions with external HTTP
>  > > servers (notably Squid).
>  >
>  > True, but RAM caching is still useful where pages which use expensive
>  > operations must always be served fresh.  Do you folks see this
>  > requirement as important, or do you think it can always be avoided with
>  > a combination of efficient code and HTTP caching?
> I expect caching of page components is essential, e.g. for personalized
> pages: while, e.g. CMF pages are rarely identical (having the
> user's name in the user top bar), the "news_box" or an expensive
> to build dynamic menu component are often reusable...

You're right of course.  The easiest way I've found to do this is to
just create a trivial trampoline method that encapsulates the expensive
computation and cache it.  For example:

cacheable_postings_column (dtml method):

  <dtml-var postings_column>

The other problem that this runs into is coordinating the invalidation
of these caches between multiple ZEO clients.  I've got a custom
implementation that does this.  When I described it at Python 10 Jim
Fulton pulled me aside and mentioned that the ZEO server has the
fundamental ability to do this -- some hooks just need to be made
visible.  A fairly quick look at the ZEO source convinced me that:

1. Jim is correct (no surprise here!).  It does essentially what I
   do, but in a better way.

2. I'm not happy with making my own custom additions to the ZEO
   protocol :-(

Dan Pierson