Created
June 24, 2011 11:11
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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