You are here

MemoryBackendFactory.php in Drupal 9

Same filename and directory in other branches
  1. 8 core/lib/Drupal/Core/Cache/MemoryBackendFactory.php

Namespace

Drupal\Core\Cache

File

core/lib/Drupal/Core/Cache/MemoryBackendFactory.php
View source
<?php

namespace Drupal\Core\Cache;

class MemoryBackendFactory implements CacheFactoryInterface {

  /**
   * Instantiated memory cache bins.
   *
   * @var \Drupal\Core\Cache\MemoryBackend[]
   */
  protected $bins = [];

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

}

Classes