You are here

class QueueRedisFactory in Redis 8

Defines the queue factory for the Redis backend.

Hierarchy

Expanded class hierarchy of QueueRedisFactory

1 string reference to 'QueueRedisFactory'
redis.services.yml in ./redis.services.yml
redis.services.yml
1 service uses QueueRedisFactory
queue.redis in ./redis.services.yml
Drupal\redis\Queue\QueueRedisFactory

File

src/Queue/QueueRedisFactory.php, line 11

Namespace

Drupal\redis\Queue
View source
class QueueRedisFactory {

  /**
   * Queue implementation class namespace prefix.
   */
  const CLASS_NAMESPACE = ClientFactory::REDIS_IMPL_QUEUE;

  /**
   * @var \Drupal\redis\ClientFactory
   */
  protected $clientFactory;

  /**
   * The settings array.
   *
   * @var \Drupal\Core\Site\Settings
   */
  protected $settings;

  /**
   * Constructs this factory object.
   *
   * @param \Drupal\Core\Database\Connection $connection
   *   The Connection object containing the key-value tables.
   */
  public function __construct(ClientFactory $client_factory, Settings $settings) {
    $this->clientFactory = $client_factory;
    $this->settings = $settings;
  }

  /**
   * Constructs a new queue object for a given name.
   *
   * @param string $name
   *   The name of the collection holding key and value pairs.
   *
   * @return \Drupal\Core\Queue\DatabaseQueue
   *   A key/value store implementation for the given $collection.
   */
  public function get($name) {
    $settings = $this->settings
      ->get('redis_queue_' . $name, [
      'reserve_timeout' => NULL,
    ]);
    $class_name = $this->clientFactory
      ->getClass(static::CLASS_NAMESPACE);
    return new $class_name($name, $settings, $this->clientFactory
      ->getClient());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QueueRedisFactory::$clientFactory protected property
QueueRedisFactory::$settings protected property The settings array.
QueueRedisFactory::CLASS_NAMESPACE constant Queue implementation class namespace prefix. 1
QueueRedisFactory::get public function Constructs a new queue object for a given name.
QueueRedisFactory::__construct public function Constructs this factory object.