On Thu, 2007-10-04 at 12:11 -0700, Alexander Solovyov wrote: > Hi, > > I'm working on some big site and we are using content types very often > (for generic relations). And there are one idea appeared - why not > cache content types in the memory completely. > > Just replacing default manager of ContentType class (with monkey- > patching) with another, which will cache retrieved objects will remove > this query to database completely. > > So I'm wondering - maybe someone already have done something like > this? Or maybe someone have thoughts?
We are already doing that (caching them in memory) and for exactly the use-case you have discovered: generic relations are otherwise very costly. This was added back in January of this year, so it's even in the 0.96 release. Have a look at CONTENT_TYPE_CACHE in django/contrib/contenttypes/models.py. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---