public function KeyValueFactory::get in MongoDB 8.2
Constructs a new key/value store for a given collection name.
Parameters
string $collection: The name of the collection holding key and value pairs.
Return value
\Drupal\Core\KeyValueStore\KeyValueStoreInterface A key/value store implementation for the given $collection.
Overrides KeyValueFactoryInterface::get
1 method overrides KeyValueFactory::get()
- KeyValueExpirableFactory::get in modules/
mongodb_storage/ src/ KeyValueExpirableFactory.php - Constructs a new key/value store for a given collection name.
File
- modules/
mongodb_storage/ src/ KeyValueFactory.php, line 50
Class
- KeyValueFactory
- Class KeyValueFactory builds KeyValue stores as MongoDB collections.
Namespace
Drupal\mongodb_storageCode
public function get($collection) {
$storeCollection = $this->database
->selectCollection(static::COLLECTION_PREFIX . $collection);
$store = new KeyValueStore($collection, $storeCollection);
return $store;
}