You are here

function varnish_get_active_urls in Varnish 5

Extensible logic function to get other urls to clear.

TODO: Merge this with boost logic.

File

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

Code

function varnish_get_active_urls($node) {
  $urls = array();
  $urls[] = 'node/' . $node->nid;
  if ($node->type == 'blog') {
    $urls[] = 'blog';
    $urls[] = 'blog/' . $node->uid;
  }

  // lots more here...
  foreach ($urls as $url) {
    $alias = drupal_get_path_alias($url);

    // TODO: languages?
    if ($alias != $url) {
      $urls[] = $alias;
    }
  }
  return $urls;
}