Hi,

I today worked on ticket #580 to make the caching work better with
dependencies on headers. The problem: the current caching won't take
into account many HTTP headers and won't be easily configureable for
new headers. So for example if your page content is based on cookies,
the cache middleware won't see that and will send out content
regardless of cookie value from the cache.

Sune Kirkeby did the main work by splitting the CacheMiddleware into
three distinct middlewares: one for gzip encoding, one for HTTP
conditional GET handling and one for caching. Those are already linked
from the user contributed middlewares.

What my patch does is integrate those middlewares into django core and
to rework the decorators to be based fully on the middleware code (so
that there is only one place where cache handling is done).
Additionally I added some helper stuff to manage the Vary response
header, as that is the beast the caching now bases it's cache keys on
(before it was based on the path, the Accept-Encoding header - only
partly, as it only looked for gzip support).

I did some tests with the middlewares and the decorators and it worked
fine. Maybe somebody else want's to have a look at this stuff.

Would be great if this - or something like this - could make it into
trunk, as the current caching will collide heavily with my i18n work.

A nice side-effect of the patch: django will be one of the first python
web frameworks that fully interoperates with accellerator proxies like
squid without degrading them to simple forwarders (like Pragma:
no-cache or Cache-Control: none would do) :-)

bye, Georg

Reply via email to