a64678952e4fa51a5de467ba2da81f9e9e18bb1e
[yaffs-website] / web / core / lib / Drupal / Core / Queue / QueueDatabaseFactory.php
1 <?php
2
3 namespace Drupal\Core\Queue;
4
5 use Drupal\Core\Database\Connection;
6
7 /**
8  * Defines the key/value store factory for the database backend.
9  */
10 class QueueDatabaseFactory {
11
12   /**
13    * The database connection.
14    *
15    * @var \Drupal\Core\Database\Connection $connection
16    */
17   protected $connection;
18
19   /**
20    * Constructs this factory object.
21    *
22    * @param \Drupal\Core\Database\Connection $connection
23    *   The Connection object containing the key-value tables.
24    */
25   public function __construct(Connection $connection) {
26     $this->connection = $connection;
27   }
28
29   /**
30    * Constructs a new queue object for a given name.
31    *
32    * @param string $name
33    *   The name of the collection holding key and value pairs.
34    *
35    * @return \Drupal\Core\Queue\DatabaseQueue
36    *   A key/value store implementation for the given $collection.
37    */
38   public function get($name) {
39     return new DatabaseQueue($name, $this->connection);
40   }
41
42 }