Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

class DrupalQueue

Factory class for interacting with queues.

Hierarchy

Expanded class hierarchy of DrupalQueue

Related topics

Queue operations
Queue items to allow later processing.

File

modules/system/system.queue.inc, line 60

View source
class DrupalQueue  {
 
 /**
 * Returns the queue object for a given name.
 *
 * The following variables can be set by variable_set or $conf overrides:
 * - queue_class_$name: the class to be used for the queue $name.
 * - queue_default_class: the class to use when queue_class_$name is not
 * defined. Defaults to SystemQueue, a reliable backend using SQL.
 * - queue_default_reliable_class: the class to use when queue_class_$name is
 * not defined and the queue_default_class is not reliable. Defaults to
 * SystemQueue.
 *
 * @param $name
 * Arbitrary string. The name of the queue to work with.
 * @param $reliable
 * TRUE if the ordering of items and guaranteeing every item executes at
 * least once is important, FALSE if scalability is the main concern.
 *
 * @return
 * The queue object for a given name.
 */
 public static function get($name, $reliable = FALSE) {
 static $queues;
 if (!isset($queues[$name])) {
 $class = variable_get ('queue_class_' . $name, NULL);
 if (!$class) {
 $class = variable_get ('queue_default_class', 'SystemQueue');
 }
 $object = new $class($name);
 if ($reliable && !$object instanceof DrupalReliableQueueInterface) {
 $class = variable_get ('queue_default_reliable_class', 'SystemQueue');
 $object = new $class($name);
 }
 $queues[$name] = $object;
 }
 return $queues[$name];
 }
}

Members

Title Sort descending Modifiers Object type Summary
DrupalQueue::get public static function Returns the queue object for a given name.

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