public function MemoryQueue::createItem in Purge 8.3
Adds a queue item and store it directly to the queue.
Parameters
$data: Arbitrary data to be associated with the new task in the queue.
Return value
A unique ID if the item was successfully created and was (best effort) added to the queue, 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::createItem
File
- src/
Plugin/ Purge/ Queue/ MemoryQueue.php, line 54
Class
- MemoryQueue
- A QueueInterface compliant volatile memory buffer queue.
Namespace
Drupal\purge\Plugin\Purge\QueueCode
public function createItem($data) {
$this
->bufferInitialize();
end($this->buffer);
$id = key($this->buffer) + 1;
$this->buffer[$id] = [
self::DATA => serialize($data),
self::EXPIRE => 0,
self::CREATED => time(),
];
return $id;
}