[Twisted-web] Re: html cache with timeout
mesozoic at polynode.com
Tue Feb 1 20:21:22 MST 2005
On Wed, Feb 02, 2005 at 03:48:40AM +0100, Andrea Arcangeli wrote:
> > jamwt volunteered for writing a memcache like http://www.danga.com/memcached/
> > Which will probably be one of the backends.
> Is that a separate task? One of the benefits of having cache inside the
> python VM that runs the webserver is no context switches and no inter
> process communication. So I'm not very excited about caching outside
> nevow ;)
I think the aim should be to make this caching feature sufficiently useful
on its own, while being sufficiently extensible to allow people to do what
they want with it. It'd be nice to have the option of using memcached, or an
in-process cache, or... well, you get the idea.
I liked Matt's idea of storing something in the context, like an
ICacheManager. Of course, I should disclose I liked the idea because I'd
planned on the same thing for Payago. :)
> Ok, so it's up to me to avoid collisions, it's not like the more
> lowlevel cache where the url was picked automatically.
Yes, and if you don't trust yourself to avoid collisions, having the cache
manager remembered in the context will let you implement a URL picker :)
Of course, I think caching is one of those problems that will always be very
site-specific, and any implementation that involves modifying the Page class
is going to be either too general-purpose to be useful, or too invasive to
be stable all the time, for all projects. Your httprender patch is useful,
but probably better placed in a subclass.
My two cents (adjusted for inflation).
"Never let your sense of morals prevent you from doing what is right."
-- Salvor Hardin, Isaac Asimov's _Foundation_
More information about the Twisted-web