Cache invalidating with generic class based views

34 views
Skip to first unread message

Martin Owens

unread,
Apr 30, 2016, 12:36:36 AM4/30/16
to Django developers (Contributions to Django itself)
Dear django developers,

I've had to develop a middleware piece for the django website inkscape.org, the website requires page caching for it's django-cms parts, but was suffering horribly from over-caching on non-cms pages.

What I want to ask is, is a generic solution to generic class based views a crazy idea and if not, is it something that has already been done (hopefully better by someone)?

You can see the middleware piece I've written here, designed for django 1.8:

http://bazaar.launchpad.net/~inkscape-webadmin/inkscape-web/inkscape-web/revision/1214

The core of the idea is to record view cache keys against object and model ids and then invalidate those cache keys when that model is saved. There are a few non generic views that needed some extra code, and I imagine there could be views that use multiple objects or multiple querysets would need work to make it better.

Best Regards, Martin Owens
Reply all
Reply to author
Forward
0 new messages