Clear views cache when insert, update, delete node in Drupal 7
This blog describes how to clear views cache while inserting, updating and deleting a node. If we want to improve site performance, then views caching is one of the options.
For example, let's consider that there is a view that display list of records and it will be updated occasionally. Then we can render views data from cache rather than server by setting up cache for views. We can set views cache at Advanced section of its settings page. Drupal supports time based caching by default. We can cache the views until 6 days. If you want to cache the views over 6 days, then you could select 'Custom' option and fill number of seconds in 'Seconds' textbox.
Suppose you have cached views for 30 mins. Then it won't display updated data until 30 mins, even if new node is added to that views. It displays updated data only after 30 mins because the views is cached for 30 mins. In that situation, the user can't view new data in cached views. So we need to clear views cache when we add a new node. Then only we can see new data in views and also data is rendered from cache.
Lets see how to clear views cache while inserting node: