[mod_python] Caching pages

Graham Dumpleton grahamd at dscpl.com.au
Fri Oct 27 22:05:17 EDT 2006

On 28/10/2006, at 10:13 AM, Aaron Gallagher wrote:

> Is there a builtin interface in mod_python that would allow for  
> caching a generated page? Using Sessions doesn't work because I  
> want the cache to be for every user who accesses the page. I tried  
> using Session.Session(req, '0' * 32), but that didn't seem to work.  
> I've looked at mod_python.cache, but there doesn't seem to be any  
> documentation.

Don't use mod_python.cache as that will disappear in a future version
of mod_python as it was only effectively an interim solution for  
It was also only really ever meant to be an internal implementation  
and not part of any public API.

Now, if you are talking about caching generated HTML, you may want
to look at using the mod_cache module for Apache in some way. Ie.,
generic caching is perhaps better done outside of mod_python. See:


To make best use of mod_cache, you may need to embed headers in
your responses to guide it how long to cache a page before it should be


More information about the Mod_python mailing list