You are here

public function QueueBase::createItemMultiple in Purge 8.3

Add multiple items to the queue and store them efficiently.

Parameters

array $items: Non-associative array containing arrays with arbitrary data to be associated with the new tasks in the queue.

Return value

array|false Non-associative array containing unique ID's for the items that were saved successfully, otherwise FALSE. We don't guarantee the item was committed to disk etc, but as far as we know, the item is now in the queue.

Overrides QueueInterface::createItemMultiple

1 method overrides QueueBase::createItemMultiple()
MemoryQueue::createItemMultiple in src/Plugin/Purge/Queue/MemoryQueue.php
Add multiple items to the queue and store them efficiently.

File

src/Plugin/Purge/Queue/QueueBase.php, line 28

Class

QueueBase
Provides a ReliableQueueInterface compliant queue that holds queue items.

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

public function createItemMultiple(array $items) {
  $ids = [];

  // This implementation emulates multiple creation and is NOT efficient. It
  // exists for API reliability and invites derivatives to override it, for
  // example: by one multi-row database query.
  foreach ($items as $data) {
    if (($item = $this
      ->createItem($data)) === FALSE) {
      return FALSE;
    }
    $ids[] = $item;
  }
  return $ids;
}