Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

CacheFactory.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\ApiLoader;
8
9 use eZ\Publish\Core\MVC\ConfigResolverInterface;
10 use Symfony\Component\Cache\Adapter\TagAwareAdapter;
11 use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
12 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
13 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
14
20 class CacheFactory implements ContainerAwareInterface
21 {
22 use ContainerAwareTrait;
23
29 public function getCachePool(ConfigResolverInterface $configResolver = null)
30 {
31 $cacheService = null;
32
33 if ($configResolver !== null) {
34 $cacheServiceName = $configResolver->getParameter('cache_service_name');
36 $cacheService = $this->container->get($cacheServiceName);
37 } else {
38 $cacheService = $this->container->get('cache.app');
39 }
40
41 // If cache service is already implementing TagAwareAdapterInterface, return as-is
42 if ($cacheService instanceof TagAwareAdapterInterface) {
43 return $cacheService;
44 }
45
46 return new TagAwareAdapter(
47 $cacheService
48 );
49 }
50 }
eZ\Bundle\EzPublishCoreBundle\ApiLoader\CacheFactory
Class CacheFactory.
Definition: CacheFactory.php:21
eZ\Publish\Core\MVC\ConfigResolverInterface
Interface for config resolvers.
Definition: ConfigResolverInterface.php:19
eZ\Bundle\EzPublishCoreBundle\ApiLoader
Definition: CacheFactory.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.