Skip to content

Instantly share code, notes, and snippets.

@wojtha
Created June 24, 2011 11:11
Show Gist options
  • Select an option

  • Save wojtha/1044587 to your computer and use it in GitHub Desktop.

Select an option

Save wojtha/1044587 to your computer and use it in GitHub Desktop.
Drupal snippet: Revoke Views cache on each insert, update, delete of the node
<?php
/**
* Implementation of hook_nodeapi().
*
* Revoke Views cache on each insert, update, delete of the node.
*/
function mymodule_special_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// Clear all cached views results and rendered outputs on node updates
// for particular views:
// <view_id>:<display_id>:<result|output>:<hash 32>
// reference1:panel_pane_1:results:dba3a4f4b6448235e3ca60b4a278e3e6
switch ($op) {
case 'insert':
case 'update':
case 'delete':
cache_clear_all('*', 'cache_views_data', TRUE);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment