class VariationCacheFactory

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Cache/VariationCacheFactory.php \Drupal\Core\Cache\VariationCacheFactory

Defines the variation cache factory.

Hierarchy

Expanded class hierarchy of VariationCacheFactory

Related topics

1 string reference to 'VariationCacheFactory'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses VariationCacheFactory
variation_cache_factory in core/core.services.yml
Drupal\Core\Cache\VariationCacheFactory

File

core/lib/Drupal/Core/Cache/VariationCacheFactory.php, line 13

Namespace

Drupal\Core\Cache
View source
class VariationCacheFactory implements VariationCacheFactoryInterface {
  
  /**
   * Instantiated variation cache bins.
   *
   * @var \Drupal\Core\Cache\VariationCacheInterface[]
   */
  protected $bins = [];
  
  /**
   * Constructs a new VariationCacheFactory object.
   *
   * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
   *   The request stack.
   * @param \Drupal\Core\Cache\CacheFactoryInterface $cacheFactory
   *   The cache factory.
   * @param \Drupal\Core\Cache\Context\CacheContextsManager $cacheContextsManager
   *   The cache contexts manager.
   */
  public function __construct(protected RequestStack $requestStack, protected CacheFactoryInterface $cacheFactory, protected CacheContextsManager $cacheContextsManager) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function get($bin) {
    if (!isset($this->bins[$bin])) {
      $this->bins[$bin] = new VariationCache($this->requestStack, $this->cacheFactory
        ->get($bin), $this->cacheContextsManager);
    }
    return $this->bins[$bin];
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
VariationCacheFactory::$bins protected property Instantiated variation cache bins.
VariationCacheFactory::get public function Gets a variation cache backend for a given cache bin. Overrides VariationCacheFactoryInterface::get
VariationCacheFactory::__construct public function Constructs a new VariationCacheFactory object.

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