Hi,

On Thu, Jan 21, 2010 at 7:35 AM, Russell Keith-Magee <freakboy3...@gmail.com
> wrote:

> On Thu, Jan 21, 2010 at 7:47 AM, Malcolm Box <malcolm....@gmail.com>
> wrote:
> >
> > I've got a simple question that I can't find the answer to:  if the data
> > that a view depends on changes, does Django do anything smart to
> invalidate
> > the cache for that view, or is it left to the programmer?
>


> >Your suspicions are correct - there is no systematic cache
>  invalidation tied to Django's models.
>
> Thanks for the confirmation!


> If you want to invalidate a specific view, you will need to use the
> cache key tools to django.utils.cache to reconstruct the key for the
> view that needs to be invalidated. See the cache middleware for
> examples of usage.
>

So a higher-level question - is this the prefered design approach - have the
views that alter data explicitly invalidate the views in the cache for the
ones who's data has been changed?

It feels a bit too tightly coupled to me - and fragile if new views are
added.

What's the recommended approach, or what have others done that's worked?

A few more details on my app if that helps:  it's a voting app, so some data
(e.g. the polls, questions etc) change infrequently, whereas the number of
votes and current result change frequently.  I'm aiming to scale to handle
tens of thousands of votes per second.

Cheers,

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-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply via email to