function Memory::createItem

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Queue/Memory.php \Drupal\Core\Queue\Memory::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.