You are here

public function KeyValueDatabaseExpirableFactory::get in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory::get()

Constructs a new expirable 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 An expirable key/value store implementation for the given $collection.

Overrides KeyValueExpirableFactoryInterface::get

File

core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php, line 55
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) {
  if (!isset($this->storages[$collection])) {
    $this->storages[$collection] = new DatabaseStorageExpirable($collection, $this->serializer, $this->connection);
  }
  return $this->storages[$collection];
}