KeyValueMemoryFactory.php

Same filename and directory in other branches
  1. 8.9.x core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php
  2. 10 core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php
  3. 11.x core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php

Namespace

Drupal\Core\KeyValueStore

File

core/lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php

View source
<?php

namespace Drupal\Core\KeyValueStore;


/**
 * Defines the key/value store factory for the memory backend.
 */
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];
  }

}

Classes

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

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