You are here

function cache_actions_action_clear_varnish_page in Cache Actions 7

Same name and namespace in other branches
  1. 6.2 cache_actions.rules.inc \cache_actions_action_clear_varnish_page()

File

./cache_actions.rules.inc, line 561
This file provides the rules integration for this module.

Code

function cache_actions_action_clear_varnish_page($paths) {
  if (module_exists('varnish')) {
    $paths = explode("\r\n", $paths);

    // Since varnish don't understand things like <front>, we need to
    // Replace that with something it does understand. If <front> exists more than
    // once, we ignore it, since the cache will be cleared anyway.
    if (($key = array_search('<front>', $paths)) !== FALSE) {
      $paths[$key] = '';
    }
    varnish_expire_cache($paths);
  }
}