On Feb 21, 2010, at 1:22 PM, Itay Donenhirsch wrote:
hi folks, a little question: when using any caching mechanism (say,
memcache) with django, how does django know when to "refresh" the
cache?
a scenario for example:
1. user gets a page, gets page content A
2. someone changes the state of the database so A -> A'
3. user refreshes the same page, does he get A or A'?
how does django know to handle this?
Django doesn't; hopefully, you do. :)
The "binding" (in a very general sense) between your model and the
templates that get rendered to the client is your view function;
Django doesn't inherently know what cached templates depend on which
rows in the database. Thus, it's really your code that knows what
cached templates need to be invalidated when a database change
occurs. The typical way of doing this for the view function that
handles the database update also does the appropriate cached template
invalidation.
--
-- Christophe Pettus
x...@thebuild.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-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.