You are here

public function QueueService::commit in Purge 8.3

Commit all actions in the internal buffer to the queue.

Parameters

bool $sync_stat: Sync the numberOfItems statistic after the queue content has changed.

4 calls to QueueService::commit()
QueueService::destruct in src/Plugin/Purge/Queue/QueueService.php
Performs destruct operations.
QueueService::numberOfItems in src/Plugin/Purge/Queue/QueueService.php
Retrieves the number of items in the queue.
QueueService::reload in src/Plugin/Purge/Queue/QueueService.php
Reload the service and reinstantiate all enabled plugins.
QueueService::selectPage in src/Plugin/Purge/Queue/QueueService.php
Select a page of queue data with a limited number of items.

File

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

Class

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

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

public function commit($sync_stat = TRUE) {
  if (!count($this->buffer)) {
    return;
  }
  $this
    ->commitAdding();
  $this
    ->commitReleasing();
  $this
    ->commitDeleting();

  // If tasked to do so, sync the numberOfItems stat since the queue changed.
  if ($sync_stat) {
    $this->purgeQueueStats
      ->numberOfItems()
      ->set($this
      ->numberOfItems());
  }
}