On Fri, 2007-11-30 at 12:08 -0800, Brian Morton wrote:
> I have an interesting idea that I am not quite sure how to pursue.
> I'm wondering if any of you have figured this out already.
> 
> What I would like to do is set the cache expiration for a particular
> object in the cache to be very high, and then delete the item from the
> cache when an instance of its model is saved.  This would be
> particularly useful for a site where the data only changes through the
> admin interface, and not very frequently.  This way, the object can
> stay cached as long as it has not changed.
> 
> I was thinking of trying something with the post_save signal and the
> cache middleware.  Has anyone tried this already?  Or is this a bad
> idea?

The usually difficult part of this type of proposal is querysets. You
need to find every cached queryset that contains the model in question
and delete it as well. This essentially requires scanning every queryset
(or coming up with a really good hash function to enable cutting down
the search set). There was a Summer of Code project that tried to do
this, but it didn't seem to go anywhere.

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

Reply via email to