You are here

public function Memory::createItem in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Queue/Memory.php \Drupal\Core\Queue\Memory::createItem()
  2. 9 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;
}