class MemoryCacheFactory

Same name in other branches
  1. 10 core/lib/Drupal/Core/Cache/MemoryCache/MemoryCacheFactory.php \Drupal\Core\Cache\MemoryCache\MemoryCacheFactory

Hierarchy

Expanded class hierarchy of MemoryCacheFactory

File

core/lib/Drupal/Core/Cache/MemoryCache/MemoryCacheFactory.php, line 8

Namespace

Drupal\Core\Cache\MemoryCache
View source
class MemoryCacheFactory implements CacheFactoryInterface {
    
    /**
     * Instantiated memory cache bins.
     *
     * @var \Drupal\Core\Cache\MemoryBackend[]
     */
    protected $bins = [];
    
    /**
     * Constructs a MemoryCounterBackendFactory object.
     *
     * @param \Drupal\Component\Datetime\TimeInterface $time
     *   The time service.
     */
    public function __construct(TimeInterface $time) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function get($bin) {
        if (!isset($this->bins[$bin])) {
            $this->bins[$bin] = new MemoryCache($this->time);
        }
        return $this->bins[$bin];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
MemoryCacheFactory::$bins protected property Instantiated memory cache bins.
MemoryCacheFactory::get public function Gets a cache backend class for a given cache bin. Overrides CacheFactoryInterface::get
MemoryCacheFactory::__construct public function Constructs a MemoryCounterBackendFactory object.

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