On 7/5/07, David Cramer <[EMAIL PROTECTED]> wrote:
>
> Ya cache invalidation is something you'll always have a problem with.
> The clean() method can be used (at the end of a queryset, or on the
> Manager itself) to force the invalidation.

We have been working on this issue recently and came up with a
mechanism that solves this problem for us - when creating a cache, we
register with a CacheInvalidator object a model, test and a cache key.
CacheInvalidator than listens for post_save signals and for every
model check the registered tests... if a test passes, the cache_key
associated with the test is deleted. So if you can construct a test
based on the QuerySet's filters etc, you will be able to invalidate
just the querysets actually affected by the change...

We haven't tested it for performance (we are building a high-volume
site) yet and we still haven't figured out how to deal with multiple
web servers connecting to one cache (our working version includes
propagating the post_save signal via some asynchronous communication
channel like apache's ActiveMQ, but we might end up with a separate
server just for the cache invalidation).

Is anybody interested in this?

> As for _get_sql_clause I guess I could make it just pull from filters/
> extra args to build the key -- not as clean but it's the only other
> way I can think of.
>
> On Jul 4, 11:25 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> > On 7/5/07, David Cramer <[EMAIL PROTECTED]> wrote:
> >
> > >http://www.davidcramer.net/code/50/django-cachemanager.html
> >
> > > Criticism welcomed!
> >
> > I think the order of bits returned from _get_sql_clause is dependent
> > on how the queryset is built up, so that you'll cache equivalent
> > result sets repeatedly.
> >
> > And there's the issue of cache invalidation.
> >
> > But definitely useful.
>
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~---------~--~----~------------~-------~--~----~
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