Also consider using Johnny Cache or CacheMachine backed by memcached.
Johnny Cache does automatic invalidation, but will invalidate an entire table's cache on one write. If you have a site with a small number of writes, this is an easy and instant win. Setup is under ten lines of configuration.
CacheMachine, on the other hand, tracks the objects that were returned for individual queries. The queries are invalidated when one of the associated objects changes, but not when a new object is added to the db. I believe addons.mozilla.com uses this.
Johnny Cache does automatic invalidation, but will invalidate an entire table's cache on one write. If you have a site with a small number of writes, this is an easy and instant win. Setup is under ten lines of configuration.
CacheMachine, on the other hand, tracks the objects that were returned for individual queries. The queries are invalidated when one of the associated objects changes, but not when a new object is added to the db. I believe addons.mozilla.com uses this.
http://packages.python.org/johnny-cache/
https://github.com/jbalogh/django-cache-machine