Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Cache / DatabaseBackendFactory.php
1 <?php
2
3 namespace Drupal\Core\Cache;
4
5 use Drupal\Core\Database\Connection;
6
7 class DatabaseBackendFactory implements CacheFactoryInterface {
8
9   /**
10    * The database connection.
11    *
12    * @var \Drupal\Core\Database\Connection
13    */
14   protected $connection;
15
16   /**
17    * The cache tags checksum provider.
18    *
19    * @var \Drupal\Core\Cache\CacheTagsChecksumInterface
20    */
21   protected $checksumProvider;
22
23   /**
24    * Constructs the DatabaseBackendFactory object.
25    *
26    * @param \Drupal\Core\Database\Connection $connection
27    *   Database connection
28    * @param \Drupal\Core\Cache\CacheTagsChecksumInterface $checksum_provider
29    *   The cache tags checksum provider.
30    */
31   public function __construct(Connection $connection, CacheTagsChecksumInterface $checksum_provider) {
32     $this->connection = $connection;
33     $this->checksumProvider = $checksum_provider;
34   }
35
36   /**
37    * Gets DatabaseBackend for the specified cache bin.
38    *
39    * @param $bin
40    *   The cache bin for which the object is created.
41    *
42    * @return \Drupal\Core\Cache\DatabaseBackend
43    *   The cache backend object for the specified cache bin.
44    */
45   public function get($bin) {
46     return new DatabaseBackend($this->connection, $this->checksumProvider, $bin);
47   }
48
49 }