1 system.queue.inc | public static BackdropQueue::get($name, $reliable = FALSE) |
Returns the queue object for a given name.
The following can be set in settings.php through the $settings variable:
- 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.
Parameters
$name: Arbitrary string. The name of the queue to work with.
$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 value
BackdropQueueInterface: The queue object for a given name.
File
- core/
modules/ system/ system.queue.inc, line 79 - Queue functionality.
Class
- BackdropQueue
- Factory class for interacting with queues.
Code
public static function get($name, $reliable = FALSE) {
static $queues;
if (!isset($queues[$name])) {
$class = settings_get('queue_class_' . $name, NULL);
if (!$class) {
$class = settings_get('queue_default_class', 'SystemQueue');
}
$object = new $class($name);
if ($reliable && !$object instanceof BackdropReliableQueueInterface) {
$class = settings_get('queue_default_reliable_class', 'SystemQueue');
$object = new $class($name);
}
$queues[$name] = $object;
}
return $queues[$name];
}