public function MemoryQueue::createItem

public MemoryQueue::createItem($data)

Add 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

TRUE 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 DrupalQueueInterface::createItem

File

modules/system/system.queue.inc, line 322
Queue functionality.

Class

MemoryQueue
Static queue implementation.

Code

public function createItem($data) {
  $item = new stdClass();
  $item->item_id = $this->id_sequence++;
  $item->data = $data;
  $item->created = time();
  $item->expire = 0;
  $this->queue[$item->item_id] = $item;
  return TRUE;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.queue.inc/function/MemoryQueue::createItem/7.x