public function KeyValueExpirableFactory::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\KeyValueStoreExpirableInterface A key/value store implementation for the given $collection.
Overrides KeyValueFactory::get
See also
drush_mongodb_storage_import_keyvalue()
File
- modules/
mongodb_storage/ src/ KeyValueExpirableFactory.php, line 51
Class
- KeyValueExpirableFactory
- 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 KeyValueStoreExpirable($collection, $storeCollection);
$store
->setTimeService($this->time);
return $store;
}