[Zope-CMF] Re: Re: CachingPolicyManager improvements

Geoff Davis geoff at phds.org
Mon Sep 5 16:20:02 EDT 2005

On Mon, 05 Sep 2005 12:30:47 -0700, Alec Mitchell wrote:
>> If you write your ETags in an appropriate way, this works beautifully for
>> views.  Consider an ETag that consists of a string containing (1) the
>> content object's modification date, (2) the user name for the currently
>> authenticated user, and (3) the current time rounded to the nearest
>> hour. If a user gets this content while logged in, the ETag will match
>> (1) when s/he is logged in, (2) if the content has not changed, and (3) if
>> the cached copy is less than an hour old.  You get cached, personalized
>> content that is guaranteed not to be stale and has an expiration time
>> that you control.  Very good stuff.
> Except for any dynamic portlets on the page, but that's what ESI is for I 
> guess.  AJAX loaded content areas (which themselves could be cached with an 
> ETag) would help here as well.

Alternatively you can create a function that checks the modification times
for the content and for all portlets as well.  Embed that composite time
in your ETag and you're all set.  ESI would be cool, too, but I'm not
betting that we'll see that any time soon.

Chris McDonough suggested an interesting way to do a poor-man's ESI: use
Apache's server side includes.  Along the same lines, if you set up
all have portlets to be methods that return a chunk of xhtml instead of
ZPT macros, then you could fetch your portlets through Squid rather than
by calling the methods directly.  You'd have some overhead in assembling
the page, but you'd get many of the benefits of ESI without having to wait
for a Squid 3 release.  

More information about the Zope-CMF mailing list