class KeyValueMemoryFactory

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php \Drupal\Core\KeyValueStore\KeyValueMemoryFactory
  2. 8.9.x core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php \Drupal\Core\KeyValueStore\KeyValueMemoryFactory
  3. 10 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

9 files declare their use of KeyValueMemoryFactory
CheckpointStorageTest.php in core/tests/Drupal/Tests/Core/Config/Checkpoint/CheckpointStorageTest.php
CronTest.php in core/tests/Drupal/Tests/Core/CronTest.php
KernelTestBase.php in core/tests/Drupal/KernelTests/KernelTestBase.php
LocaleProjectStorageTest.php in core/modules/locale/tests/src/Unit/LocaleProjectStorageTest.php
MatcherDumperTest.php in core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php

... See full list

File

core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php, line 8

Namespace

Drupal\Core\KeyValueStore
View source
class KeyValueMemoryFactory implements KeyValueFactoryInterface {
    
    /**
     * An array of keyvalue collections that are stored in memory.
     *
     * @var array
     */
    protected $collections = [];
    
    /**
     * {@inheritdoc}
     */
    public function get($collection) {
        if (!isset($this->collections[$collection])) {
            $this->collections[$collection] = new MemoryStorage($collection);
        }
        return $this->collections[$collection];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.