3 namespace Drupal\Core\Cache;
5 use Drupal\Core\Database\Connection;
7 class DatabaseBackendFactory implements CacheFactoryInterface {
10 * The database connection.
12 * @var \Drupal\Core\Database\Connection
14 protected $connection;
17 * The cache tags checksum provider.
19 * @var \Drupal\Core\Cache\CacheTagsChecksumInterface
21 protected $checksumProvider;
24 * Constructs the DatabaseBackendFactory object.
26 * @param \Drupal\Core\Database\Connection $connection
28 * @param \Drupal\Core\Cache\CacheTagsChecksumInterface $checksum_provider
29 * The cache tags checksum provider.
31 public function __construct(Connection $connection, CacheTagsChecksumInterface $checksum_provider) {
32 $this->connection = $connection;
33 $this->checksumProvider = $checksum_provider;
37 * Gets DatabaseBackend for the specified cache bin.
40 * The cache bin for which the object is created.
42 * @return \Drupal\Core\Cache\DatabaseBackend
43 * The cache backend object for the specified cache bin.
45 public function get($bin) {
46 return new DatabaseBackend($this->connection, $this->checksumProvider, $bin);