public function MemoryQueue::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 QueueBase::createItemMultiple
File
- src/
Plugin/ Purge/ Queue/ MemoryQueue.php, line 69
Class
- MemoryQueue
- A QueueInterface compliant volatile memory buffer queue.
Namespace
Drupal\purge\Plugin\Purge\QueueCode
public function createItemMultiple(array $items) {
$this
->bufferInitialize();
end($this->buffer);
$id = key($this->buffer) + 1;
$ids = [];
foreach ($items as $data) {
$this->buffer[$id] = [
self::DATA => serialize($data),
self::EXPIRE => 0,
self::CREATED => time(),
];
$ids[] = $id;
$id++;
}
return $ids;
}