You are here

function akamai_purge_paths in Akamai 7.3

Purges a set of paths from Akamai's cache.

If purge request queuing is enabled, the path will be queued and submitted to the CCU API when cron is run.

If purge request queing is not enabled, the purge request will be made immediately.

Parameters

array $paths: A set of paths to purge. Aliases and other paths will not be added to the list of paths. These paths should already be properly formatted and include the base path (e.g. "/node/34", "/sitemap.xml").

string $hostname: The hostname at which the paths to be purged exist. If omitted, the hostname will be obtained from the akamai_get_hostname() function.

Return value

mixed A response object if the purge request was submitted successfully. FALSE if purge request submission or queing failed. TRUE if the request was queued.

3 calls to akamai_purge_paths()
akamai_expire_cache in ./akamai.module
Implements hook_expire_cache().
akamai_manual_purge_form_submit in ./akamai.admin.inc
Form submission handler for akamai_manual_purge_form().
akamai_purge_path in ./akamai.module
Purges a path and its related paths from Akamai's cache.

File

./akamai.module, line 304
Integration with Akamai CDN CCU API.

Code

function akamai_purge_paths(array $paths, $hostname = NULL) {
  if (empty($hostname)) {
    $hostname = akamai_get_hostname();
  }

  // Either queue the purge request or submit it now.
  if (variable_get('akamai_queue_purge_requests', FALSE)) {
    return akamai_queue_purge_request($hostname, $paths);
  }
  else {
    $result = akamai_submit_purge_request($hostname, $paths);
    if ($result == FALSE && variable_get('akamai_queue_on_failure', TRUE)) {
      return akamai_queue_purge_request($hostname, $paths);
    }
  }
  return $result;
}