Instantiates and statically caches the correct class for a queue.
The following variables can be set by variable_set or $conf overrides:
string $name: The name of the queue to work with.
bool $reliable: TRUE if the ordering of items and guaranteeing every item executes at least once is important, FALSE if scalability is the main concern. Defaults to FALSE.
Drupal\Core\Queue\QueueInterface The queue object for a given name.
Drupal\Core\Queue\QueueInterface
function queue($name, $reliable = FALSE) {
static $queues;
if (!isset($queues[$name])) {
$class = variable_get('queue_class_' . $name, NULL);
if ($class && $reliable && in_array('Drupal\\Core\\Queue\\ReliableQueueInterface', class_implements($class))) {
$class = variable_get('queue_default_reliable_class', 'Drupal\\Core\\Queue\\System');
}
elseif (!$class) {
$class = variable_get('queue_default_class', 'Drupal\\Core\\Queue\\System');
}
$queues[$name] = new $class($name);
}
return $queues[$name];
}