http://code.djangoproject.com/ticket/5570
But mir closed my ticket because it think patch is not convenient.
I think there are a lot of files with same type of caching. I don't
use django cache framework. I use a simple dictionary for caching.
For example you can find caching of contenttypes in this other file:
http://code.djangoproject.com/browser/django/trunk/django/contrib/contenttypes/models.py
Why is not accepted my patch? Is it not the same like previous file?
There's a difference. The example you refer to uses a cache to cache
content types, nothing else, and the content types don't change usually.
Your idea would introduce an ever-growing cache for _all_ generic foreign
key lookups, and then were into something completely different. An example:
First, a view accesses a related object. This is then put into the cache.
When the the related object is changed in the database, it still is in
the cache (but out of date).
When you now accesss the object again in the same way, you get the
out-dated copy from the cache. This should not happen.
Michael
--
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk -
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689
obj1.related_object
select * from django_content_types where id = 4 ---> a content type
for one relationship
select * from myapp_mytable where id = 27 ---> this is not NEVER
cached
obj2.related_object
select * from django_content_types where id = 4 ---> a content type
for other relationship (CACHED because id is 4)
select * from myapp_mytable where id = 47 ---> this is not NEVER
cached
On 22 sep, 03:05, Michael Radziej <m...@noris.de> wrote:
> On Fri, Sep 21, msaelices wrote:
>
> > I have uploaded a patch for improve generic relations performance:
>
> > http://code.djangoproject.com/ticket/5570
>
> > But mir closed my ticket because it think patch is not convenient.
>
> > I think there are a lot of files with same type of caching. I don't
> > use django cache framework. I use a simple dictionary for caching.
>
> > For example you can find caching of contenttypes in this other file:
>
> >http://code.djangoproject.com/browser/django/trunk/django/contrib/con...
>
> > Why is not accepted my patch? Is it not the same like previous file?
>
> There's a difference. The example you refer to uses a cache to cache
> content types, nothing else, and the content types don't change usually.
>
> Your idea would introduce an ever-growing cache for _all_ generic foreign
> key lookups, and then were into something completely different. An example:
>
> First, a view accesses a related object. This is then put into the cache.
> When the the related object is changed in the database, it still is in
> the cache (but out of date).
>
> When you now accesss the object again in the same way, you get the
> out-dated copy from the cache. This should not happen.
>
> Michael
>
> --
> noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
> Tel +49-911-9352-0 - Fax +49-911-9352-100http://www.noris.de- The IT-Outsourcing Company
>
> You don't see well the code.
Oh, you're right!
I better stop triaging and go to bed now ;-)
To quote Malcolm: Sorry for the unconvenience ;-)
Michael
--
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
Good night. I do the same (It's 3:26AM) :-(
>
> To quote Malcolm: Sorry for the unconvenience ;-)
>
> Michael
>
> --
> noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
> Tel +49-911-9352-0 - Fax +49-911-9352-100http://www.noris.de- The IT-Outsourcing Company