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.
Thanks, I'll check that out. How does it compare to johnny-cache, which is what I've been using? It has the advantage for me that I only need to include it in settings.py, and I don't need to manually plug in a manager into my models, so it's easy to enable and disable for testing. Also, it has support for different caching backends, so I can have multiple django instances using a common memcache for the models even if the models are highly mutable.
Well, I'm not very familiar with johnny-cache, so I don't want to say a lot. It's quite possible that it does everything guacamole does and more.
The point of guacamole is that you probably don't want to cache every database read. You probably just want to cache a few models. I.e., if your database has 1 million items (which are frequently updated) and 1000 brands (which are more or less static), you probably want to cache those 1000 brands but not the million items.
Once you've done that, actions like
{% for item in items %}
{{ item.brand.name}}
{% endfor %}
no longer involve sending 50 queries to the db. (Or even to memcached - 50 hits to memcached can still be 25-50ms.)
Guacamole doesn't support other cache backends, though that would be pretty easy to add.
Here is one such effort (shameless plug): https://github.com/stucchio/Guacamole