how to invalidate per-view cache?

44 views
Skip to first unread message

galgal

unread,
Aug 19, 2011, 6:32:19 PM8/19/11
to django...@googlegroups.com
I want to use per-view cache. I know how it's working, but where's the problem? How can I invalidate that cache? I must do it each time database records are changed. There is no info about how to do that:/

Malcolm Box

unread,
Aug 20, 2011, 6:54:12 AM8/20/11
to django...@googlegroups.com
On 19 August 2011 23:32, galgal <weglare...@gmail.com> wrote:
I want to use per-view cache. I know how it's working, but where's the problem? How can I invalidate that cache? I must do it each time database records are changed. There is no info about how to do that:/

You'll need to use the low-level cache API to invalidate the individual cache entries. Hook up a post_save handler to your model, figure out the key(s) for the views affected and use cache.delete() to remove the entry.

Malcolm 


--
Malcolm Box
malco...@gmail.com

Reply all
Reply to author
Forward
0 new messages