You are here

function varnish_nodeapi in Varnish 5

Same name and namespace in other branches
  1. 6 varnish.module \varnish_nodeapi()

Implementation of hook_nodeapi()

Used to pick up cache_clearing events

File

./varnish.module, line 83
varnish.module Provide drupal hooks for integration with the Varnish control layer.

Code

function varnish_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($op == 'insert' || $op == 'update') {

    // We've probably just run through node_save, and normally this is where
    // Drupal calls a cache_clear_all().
    switch (variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR)) {
      case VARNISH_DEFAULT_CLEAR:
        varnish_purge_all_pages();
        break;
    }
  }
}