function KeyValueMemoryFactory::get

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php \Drupal\Core\KeyValueStore\KeyValueMemoryFactory::get()
  2. 10 core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php \Drupal\Core\KeyValueStore\KeyValueMemoryFactory::get()
  3. 11.x core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php \Drupal\Core\KeyValueStore\KeyValueMemoryFactory::get()

Overrides KeyValueFactoryInterface::get

File

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

Class

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

Namespace

Drupal\Core\KeyValueStore

Code

public function get($collection) {
    if (!isset($this->collections[$collection])) {
        $this->collections[$collection] = new MemoryStorage($collection);
    }
    return $this->collections[$collection];
}

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