That's an interesting solution. My main reason for not doing that is
because I've been told the dispatcher sucks (it's slow) and we're
going for speed.

I don't see the reasoning for adding QUERY_ to the cache_key. By
default the cache_key is your db_table. So if your model is
myapp.HelloWorld it will most likely be myapp_helloworld. But with
memcached and most caching solutions at the moment you cant do simply
invalidation with the engine. However, based on what they were talking
about with memcached's idea, you could set a generation counter in
memory to force a refresh of the entire cache, or parts of the cache,
or even handle it like the memcached proposal would.

Honza: do you not use a memcached pool? That's how we handle our
caching which would in turn keep the cache valid on all servers when
it's changed on one. Maybe your solution could go beyond a single pool
though, which would be interesting.

On Jul 11, 8:31 am, Nebojša Đorđević <[EMAIL PROTECTED]> wrote:
> On 11.07.2007., at 14:25, Nebojša Đorđević wrote:
>
> > Full code is athttp://dpaste.com/hold/14105/
>
> Here is my final take on this problem:http://dpaste.com/hold/14122/
>
> I changed caching so that all of the queries related to the one model
> are stored inside single cache key. This way I can invalidate all of
> them when change is detected.
>
> Downside is that if any of the model rows is changed all data is
> invalidated so next queries will hit DB again. OTOH this way I can be
> sure that I'll always get latest data from the DB.
>
> I tried to make new Model subclass to avoid need to add
> track_changes, but then I started to get some weird errors about
> missing table names so I returned to this approach. (I know, I know,
> model subclassing don't work, yet ;) )
>
> Tried this code on the one of the my projects and it's working nice
> (no real testing tough).
>
> --
> Nebojša Đorđević - nesh, ICQ#43799892,http://www.linkedin.com/in/
> neshdj
> Studio Quattro - Niš - 
> Serbiahttp://studioquattro.biz/|http://code.google.com/p/django-utils/
> Registered Linux User 282159 [http://counter.li.org]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to