You are here

private function QueueService::commitDeleting in Purge 8.3

Commit all deleting invalidations in the buffer to the queue.

2 calls to QueueService::commitDeleting()
QueueService::claim in src/Plugin/Purge/Queue/QueueService.php
Claim invalidation objects from the queue.
QueueService::commit in src/Plugin/Purge/Queue/QueueService.php
Commit all actions in the internal buffer to the queue.

File

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

Class

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

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

private function commitDeleting() {
  $items = $this->buffer
    ->getFiltered(TxBuffer::DELETING);
  if (!($items_count = count($items))) {
    return;
  }
  $this
    ->initializeQueue();
  if ($items_count === 1) {
    $invalidation = current($items);
    $this->queue
      ->deleteItem(new ProxyItem($invalidation, $this->buffer));
    $this->buffer
      ->delete($invalidation);
  }
  else {
    $proxyitems = [];
    foreach ($items as $item) {
      $proxyitems[] = new ProxyItem($item, $this->buffer);
    }
    $this->queue
      ->deleteItemMultiple($proxyitems);
    $this->buffer
      ->delete($items);
  }
  $this->purgeQueueStats
    ->updateTotals($items);
}