You are here

MemoryCounterBackendFactory.php in Drupal 10

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

Namespace

Drupal\Core\Cache

File

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

namespace Drupal\Core\Cache;

class MemoryCounterBackendFactory 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 MemoryCounterBackend();
    }
    return $this->bins[$bin];
  }

}

Classes