I am using view caching for a django project.
It says that the cache uses the URL as a key, so I wonder how to clear the cache of one of the keys if the user updates / deletes the object.
Example: a user posts a blog post to domain.com/post/1234/. If the user edits this, I would like to delete the cached version of this URL by adding some cache delete command at the end of the view which saves the edited post.
I use:
@cache_page(60 * 60)
def post_page(....):
If post.id is 1234, it looks like this might work, but it doesn't:
def edit_post(....):
cache.delete('/post/%s/' % post.id)
return Http.....
source
share