You are here

public function AcquiaPurgeExecutorPageCache::invalidate in Acquia Purge 7

Invalidate one or multiple paths from an external layer.

This method is responsible for clearing all the given invalidation objects from the external cache layer this executor covers. Executors decide /how/ they clear something, as long as they correctly call ::setStatusSucceeded() or ::setStatusFailed() on each processed object.

Parameters

AcquiaPurgeInvalidationInterface[] $invalidations: Unassociative list of AcquiaPurgeInvalidationInterface-compliant objects that contain the necessary info in them. You may likely need several of the following methods on the invalidation object:

  • ::getScheme(): e.g.: 'https' or 'https://' when passing TRUE.
  • ::getDomain(): e.g.: 'site.com'
  • ::getPath(): e.g.: '/basepath/products/electrical/*'
  • ::getUri(): e.g.: 'https://site.com/basepath/products/electrical/*'
  • ::hasWildcard(): call this to find out if there's a asterisk ('*').
  • ::setStatusFailed(): call this when clearing this item failed.
  • ::setStatusSucceeded(): call this when clearing this item succeeded.

Overrides AcquiaPurgeExecutorInterface::invalidate

File

lib/executor/AcquiaPurgeExecutorPageCache.php, line 26
Contains AcquiaPurgeExecutorPageCache.

Class

AcquiaPurgeExecutorPageCache
Executor that pre-clears URLs from Drupal's page cache.

Code

public function invalidate($invalidations) {
  foreach ($invalidations as $invalidation) {
    cache_clear_all($invalidation
      ->getUri(), 'cache_page');
    $invalidation
      ->setStatusSucceeded();
  }
}