You are here

public function QueueService::add in Purge 8.3

Add invalidation objects to the queue, schedule for later purging.

Parameters

\Drupal\purge\Plugin\Purge\Queuer\QueuerInterface $queuer: The queuer plugin that is queueing the invalidation objects.

\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface[] $invalidations: A non-associative array with invalidation objects to be added to the queue. After the items have been added to the queue, they can be claimed to be processed by a queue processor.

Overrides QueueServiceInterface::add

File

src/Plugin/Purge/Queue/QueueService.php, line 121

Class

QueueService
Provides the service that lets invalidations interact with a queue backend.

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

public function add(QueuerInterface $queuer, array $invalidations) {
  foreach ($invalidations as $invalidation) {
    if (!$this->buffer
      ->has($invalidation)) {
      $this->buffer
        ->set($invalidation, TxBuffer::ADDING);
    }
  }
  $this->logger
    ->debug("@queuer: added @no items.", [
    '@queuer' => $queuer
      ->getPluginId(),
    '@no' => count($invalidations),
  ]);
}