class KeyValueMemoryFactory

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

Hierarchy

Expanded class hierarchy of KeyValueMemoryFactory

1 file declares its use of KeyValueMemoryFactory
DrupalUnitTestBase.php in drupal/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
Contains Drupal\simpletest\DrupalUnitTestBase.

File

drupal/core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php, line 13
Contains Drupal\Core\KeyValueStore\KeyValueMemoryFactory.

Namespace

Drupal\Core\KeyValueStore
View source
class KeyValueMemoryFactory {

  /**
   * An array of keyvalue collections that are stored in memory.
   *
   * @var array
   */
  protected $collections = array();

  /**
   * Constructs a new key/value memory storage object for a given collection name.
   *
   * @param string $collection
   *   The name of the collection holding key and value pairs.
   * @return \Drupal\Core\KeyValueStore\MemoryStorage
   *   A key/value store implementation for the given $collection.
   */
  public function get($collection) {
    if (!isset($this->collections[$collection])) {
      $this->collections[$collection] = new MemoryStorage($collection);
    }
    return $this->collections[$collection];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
KeyValueMemoryFactory::$collections protected property An array of keyvalue collections that are stored in memory.
KeyValueMemoryFactory::get public function Constructs a new key/value memory storage object for a given collection name.