You are here

class KeyValueMemoryFactory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php \Drupal\Core\KeyValueStore\KeyValueMemoryFactory

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

Hierarchy

Expanded class hierarchy of KeyValueMemoryFactory

5 files declare their use of KeyValueMemoryFactory
KernelTestBase.php in core/modules/simpletest/src/KernelTestBase.php
Contains \Drupal\simpletest\KernelTestBase.
MatcherDumperTest.php in core/modules/system/src/Tests/Routing/MatcherDumperTest.php
Contains \Drupal\system\Tests\Routing\MatcherDumperTest.
RendererBubblingTest.php in core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
Contains \Drupal\Tests\Core\Render\RendererBubblingTest.
RouteProviderTest.php in core/modules/system/src/Tests/Routing/RouteProviderTest.php
Contains \Drupal\system\Tests\Routing\RouteProviderTest.
ThemeHandlerTest.php in core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
Contains \Drupal\Tests\Core\Extension\ThemeHandlerTest.

File

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

Namespace

Drupal\Core\KeyValueStore
View source
class KeyValueMemoryFactory implements KeyValueFactoryInterface {

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

  /**
   * {@inheritdoc}
   */
  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 store for a given collection name. Overrides KeyValueFactoryInterface::get