You are here

function fastly_expire_cache in Fastly 7

Same name and namespace in other branches
  1. 7.2 fastly.module \fastly_expire_cache()

Implements hook_expire_cache().

Provides integration with the Cache Expiration (expire) module.

File

./fastly.module, line 164
Fastly module.

Code

function fastly_expire_cache($urls, $wildcards, $object_type, $object) {
  $api = fastly_get_api();
  foreach ($urls as $url) {
    $api
      ->purgePath($url);
  }

  // For wildcards, we use the Surrogate-Key purging functionality.
  // Surrogate-Key headers are set in the response based on the
  // url path segments.
  // @See fastly_exit().
  foreach ($wildcards as $path => $wildcard) {
    if ($wildcard) {
      $api
        ->purgeKey($path);
    }
  }
}