Constructs a new key/value store for a given collection name.
string $collection: The name of the collection holding key and value pairs.
\Drupal\Core\KeyValueStore\KeyValueStoreInterface A key/value store implementation for the given $collection.
public function get($collection) {
global $conf;
if (!isset($this->stores[$collection])) {
if (isset($conf['keyvalue_service_' . $collection])) {
$service_name = $conf['keyvalue_service_' . $collection];
}
elseif (isset($conf['keyvalue_default'])) {
$service_name = $conf['keyvalue_default'];
}
else {
$service_name = 'keyvalue.database';
}
$this->stores[$collection] = $this->container
->get($service_name)
->get($collection);
}
return $this->stores[$collection];
}