W3cubDocs

/Drupal 8

public function KeyValueDatabaseExpirableFactory::get

public KeyValueDatabaseExpirableFactory::get($collection)

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 50

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];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!KeyValueStore!KeyValueDatabaseExpirableFactory.php/function/KeyValueDatabaseExpirableFactory::get/8.1.x