You are here

public function PurgerInterface::invalidate in Purge 8.3

Invalidate content from external caches.

Implementations of this method have the responsibility of invalidating the given list of invalidation objects from their external caches. Besides the invalidation itself, it also needs to call ::setState() on each object to reflect the correct state after invalidation.

You can set it to the following states:

PROCESSING is a special state only intended to be used on caching platforms where more time is required than 1-2 seconds to clear its cache. Usually CDNs with special status API calls where you can later find out if the object succeeded invalidation. When set to this state, the object flows back to the queue to be offered to your plugin again later.

NOT_SUPPORTED will be rarely needed, as invalidation types not listed as supported by your plugin will already be put to this state before it is offered to your plugin by PurgersServiceInterface::invalidate(). However, if there is any technical reason why you couldn't support a particular invalidation at that given time, you can set it as such and it will be offered again later.

Parameters

\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface[] $invalidations: Non-associative array of invalidation objects that each describe what needs to be invalidated by the external caching system. Usually these objects originate from the queue but direct invalidation is also possible, in either cases the behavior of your plugin stays the same.

The number of objects given is dictated by the outer limit of Purge's capacity tracking mechanism and is dynamically calculated. The lower your ::getTimeHint() implementation returns, the more that will be offered at once. However, your real execution time can and should never exceed the defined hint, to protect system stability.

See also

\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface::setState()

\Drupal\purge\Plugin\Purge\Purger\PurgerCapacityDataInterface::getTimeHint()

1 method overrides PurgerInterface::invalidate()
NullPurgerBase::invalidate in tests/modules/purge_purger_test/src/Plugin/Purge/Purger/NullPurgerBase.php
Invalidate content from external caches.

File

src/Plugin/Purge/Purger/PurgerInterface.php, line 102

Class

PurgerInterface
Describes a purger - the cache invalidation executor.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

public function invalidate(array $invalidations);