[Twisted-web] html cache with timeout

James Y Knight foom at fuhm.net
Mon Jan 31 22:32:25 MST 2005

On Jan 30, 2005, at 9:19 AM, Andrea Arcangeli wrote:

> On Sun, Jan 30, 2005 at 01:56:50PM +0100, Andrea Arcangeli wrote:
>> but I fixed you great hack and here we go:
> Ok I already made it good enough for merging IMHO! Please don't keep
> this in a branch that risks to get obsolete. This is a major useful
> feature IMHO.

Yes, it is. One thing that I think would make it more useful, if it can 
be pulled off, is to allow caching at any level. That is, something 
like the following stan:
html[body[cached(timeout=10, keys=(IFoo, 
IBar))[semi_constant_header_stuff], very_dynamic_content]]

That is, a function which will render its contents to a string the 
first time it's called, and store/return it for the next 10 seconds, 
using the same mechanism as the posted patch. The cache would be keyed 
off certain interfaces, and only those will get passed on to the 
functions being rendered inside, thus ensuring the safety of the cache.

I think there are a lot of pages that are mostly "semi-static", but 
have some very dynamic content in them, so something like could be 
*very* useful.

Anyhow, this is just an outline of how I think it might work, but I 
haven't tried to implement it yet, so I don't know if it will work out 
the way I'd like it to. :)


More information about the Twisted-web mailing list