-
Website
http://www.davidcramer.net/ -
Original page
http://www.davidcramer.net/code/73/caching-layer-for-django-orm.html -
Subscribe
All Comments -
Community
-
Top Commenters
-
Rob Hudson
1 comment · 3 points
-
creeva
3 comments · 1 points
-
David Cramer
93 comments · 1 points
-
MsUnderestimated
1 comment · 14 points
-
Matt B.
1 comment · 2 points
-
-
Popular Threads
Because I really have to focus on DB speed I can't use Django's select_related function. That's why I'm now caching foreign key lookups with memcache get_many calls (Just hacked this code direclty editing Django sources for now).
I had most problems with foreign key lookups and obviously count() queries - and it's amazing to have Django's ORM to manage all that caching transparently behind the scenes. Great job!
While I expect you haven't done any in depth performance testing - have you given it any sort of a work out to give some sort of an indication of the possible benefits this is going to yield for you?
Al.
After a couple tweaks to the code to get it to run (which could very well have broken it), I was finding on average the number of queries required to generate my pages went down by 1-3, and the effect was negligible. For this test, I simply changed all of my models to inherit from CachedModel instead of models.Model.