function Memory::createItem

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Queue/Memory.php \Drupal\Core\Queue\Memory::createItem()
  2. 10 core/lib/Drupal/Core/Queue/Memory.php \Drupal\Core\Queue\Memory::createItem()
  3. 11.x core/lib/Drupal/Core/Queue/Memory.php \Drupal\Core\Queue\Memory::createItem()

Overrides QueueInterface::createItem

File

core/lib/Drupal/Core/Queue/Memory.php, line 44

Class

Memory
Static queue implementation.

Namespace

Drupal\Core\Queue

Code

public function createItem($data) {
    $item = new \stdClass();
    $item->item_id = $this->idSequence++;
    $item->data = $data;
    $item->created = \Drupal::time()->getCurrentTime();
    $item->expire = 0;
    $this->queue[$item->item_id] = $item;
    return $item->item_id;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.