On the other end, you have a view for each single post, where you also list all the comments made to that post. When now a guest comments on that post, you want to invalidate the cache for the view showing this single post so that all the other users can see the comment right away without having to wait for our 10 minutes to pass.
In RoR you have the option, to tell from within an action, to expire the cache for a different action (for those of you who haven't played with Django: a controller's action in MVC/RoR is a view in Django) using something like this:
expire_action(:controller=>'posts',:action=>'view',:id=>123)
You would normally call this, when the post's author has changed something on post #123 or when someone has commented on it.
Now I'm just wondering, if someone in the Django community has already come up with a similiar method for the view-caching in the Python framework. It's not really a big issue, since you could always use the variable-based caching but it would definitely be a very handy feature and I don't seem to be the only one searching for something like this :-(
blog comments powered by Disqus