You are here

function varnish_comment in Varnish 5

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

Implementation of hook_comment()

Used to pick up cache_clearing events

File

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

Code

function varnish_comment($comment, $op) {
  switch ($op) {
    case 'insert':
    case 'update':
    case 'publish':
    case 'unpublish':
    case 'delete':
      if (variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) == VARNISH_DEFAULT_CLEAR) {
        varnish_purge_all_pages();
      }
      break;
  }
}