public function KeyValueDatabaseExpirableFactory::get

Constructs a new key/value expirable database storage object for a given collection name.

Parameters

string $collection: The name of the collection holding key and value pairs.

\Drupal\Core\Database\Connection $connection: The connection to run against.

Return value

\Drupal\Core\KeyValueStore\DatabaseStorageExpirable A key/value store implementation for the given $collection.

Overrides KeyValueDatabaseFactory::get

File

drupal/core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php, line 38
Contains Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory.

Class

KeyValueDatabaseExpirableFactory
Defines the key/value store factory for the database backend.

Namespace

Drupal\Core\KeyValueStore

Code

public function get($collection) {
  $storage = new DatabaseStorageExpirable($collection, $this->connection);
  $this->storages[] = $storage;
  return $storage;
}