Friday, January 28, 2011

Re: Invalidate cached copy when changes are made.

Thanks for the reply Matias. I'll give signals a try but pagination is
definitely a no go. I want to see all the members at a stretch.
Isn't there a simple way to tell the django cache to get a new copy,
if changes are made?

I'm sure the admin or something must have something like what i
want....

On Jan 28, 9:25 am, Matias Aguirre <matiasagui...@gmail.com> wrote:
> You could use signals[1] to update cache on save event, but I think you
> are approaching the issue in the wrong way, why not paginate[2] the
> result?
>
> Regards,
> Matías
>
> [1]:http://docs.djangoproject.com/en/dev/topics/signals/
> [2]:http://docs.djangoproject.com/en/dev/topics/pagination/
>
> Excerpts from Pranav's message of Fri Jan 28 01:36:02 -0200 2011:
>
> > Hi all,
>
> > I have a model that ruffly looks like so,
>
> > Class Member(model);
> >           member_id = model.Integerfield(primary_key=True)
> >           organization = model.foreignerkey(primary_key=True)
> >           transorg = model.foreignerkey()
> >           bo_name = model.foreignerkey()
> >          member_create_date = model.datetimefield()
> >          member_modified_date = model.datetimefield()
> >          .......
> >          class meta:
> >             db_table = 'Member'
> >             unique_together = ('member_id','organization')
>
> >        I have a view (display members) which allows user to search
> > based on multiple foreigner keys, the result ruffly returns about 811
> > Members and takes a long time to execute. So i started using cache
> > which resulted in faster serving of the page but when changes are made
> > to one of the Member the change is not shown on the display member
> > page, instead it still shows the cached page, i used decorator @cache-
> > control(must_revalidate=True) but i figured it has a max age. I
> > thought I'll use @condition(Etag_func,last_modified_func,) but i'm not
> > clear how to use it, since I'm filtering based on multiple fields,
> > also my result returns 811 members, so I'll have to check
> > member_modified_date of 811 members??? Is there a way i can use the
> > cache so that it gets a new copy when i make changes.
>
> --
> Matías Aguirre <matiasagui...@gmail.com>

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

No comments:

Post a Comment