<?php/**
* @file
* Contains Drupal\Core\KeyValueStore\KeyValueDatabaseFactory.
*/namespaceDrupal\Core\KeyValueStore;
useDrupal\Core\Database\Connection;
useDrupal\Core\Database\Database;
/**
* Defines the key/value store factory for the database backend.
*/class KeyValueDatabaseFactory {
/**
* Constructs this factory object.
*
*
* @param \Drupal\Core\Database\Connection $connection
* The Connection object containing the key-value tables.
*/function__construct(Connection $connection) {
$this->connection = $connection;
}
/**
* Constructs a new key/value database storage object for a given collection name.
*
* @param string $collection
* The name of the collection holding key and value pairs.
* @param \Drupal\Core\Database\Connection $connection
* The connection to run against.
* @return \Drupal\Core\KeyValueStore\DatabaseStorage
* A key/value store implementation for the given $collection.
*/
public functionget($collection) {
returnnewDatabaseStorage($collection, $this->connection);
}
}