I would like to add a HTTP (or WSGI) cache to my Python web application, for all requests which
GET
or HEAD
"session_id"
(known users get specialized, non-cacheable pages)"_flash"
(this cookie is used to show the user some short messages like "article created successfully", even after a redirect)"__utm"
(created by Google Analytics) they should be ignored (not stored in the cache), but the site should still be cachedIf additional common caching directives (like cache-control: private
) or even ETAGS are taken into account it would be nice too, but that is currently not a requirement.
Preferable, I do not want to run any additional piece of software like Squid (but I will use it if there a good reasons to do so), so I will prefer a mod_apache
based solution, or even some kind of memcached
powered WSGI-Middleware; Other solutions are also welcome.
Many thanks,
Christoph
I'd recommend checking out varnish. It's going to be a lot faster than any WSGI-Middleware you write/find, and you should be able to do everything you want with it. Here's the tutorial for a taste of it's many features, options: http://www.varnish-cache.org/docs/trunk/tutorial/index.html