You are here

KeyValueMemoryFactory.php in Service Container 7.2

Same filename and directory in other branches
  1. 7 lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php

File

lib/Drupal/Core/KeyValueStore/KeyValueMemoryFactory.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Core\KeyValueStore\KeyValueMemoryFactory.
 */
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 = array();

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

}

Classes

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