
| Current Path : /var/www/html/stolberg/web/core/lib/Drupal/Core/Cache/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/stolberg/web/core/lib/Drupal/Core/Cache/VariationCacheFactory.php |
<?php
namespace Drupal\Core\Cache;
use Drupal\Core\Cache\Context\CacheContextsManager;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Defines the variation cache factory.
*
* @ingroup cache
*/
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];
}
}