/** * Constructor * * @param CacheProvider $cache */ public function __construct(CacheProvider $cache = null) { $this->cache = $cache; if ($this->cache !== null && $this->cache->getNamespace() === '') { $this->cache->setNamespace(self::CACHE_NAMESPACE); } }
/** * @param ConfigProvider $securityConfigProvider * @param ConfigProvider $entityConfigProvider * @param CacheProvider|null $cache */ public function __construct(ConfigProvider $securityConfigProvider, ConfigProvider $entityConfigProvider, CacheProvider $cache = null) { $this->securityConfigProvider = $securityConfigProvider; $this->entityConfigProvider = $entityConfigProvider; $this->cache = $cache; if ($this->cache !== null && $this->cache->getNamespace() === '') { $this->cache->setNamespace(self::CACHE_NAMESPACE); } }
/** * Constructor * * @param array $owningEntityNames * @param ConfigProvider $configProvider * @param EntityClassResolver $entityClassResolver * @param CacheProvider|null $cache * * @SuppressWarnings(PHPMD.NPathComplexity) */ public function __construct(array $owningEntityNames, ConfigProvider $configProvider, EntityClassResolver $entityClassResolver = null, CacheProvider $cache = null) { $this->organizationClass = $entityClassResolver === null ? $owningEntityNames['organization'] : $entityClassResolver->getEntityClass($owningEntityNames['organization']); $this->businessUnitClass = $entityClassResolver === null ? $owningEntityNames['business_unit'] : $entityClassResolver->getEntityClass($owningEntityNames['business_unit']); $this->userClass = $entityClassResolver === null ? $owningEntityNames['user'] : $entityClassResolver->getEntityClass($owningEntityNames['user']); $this->configProvider = $configProvider; $this->cache = $cache; if ($this->cache !== null && $this->cache->getNamespace() === '') { $this->cache->setNamespace(self::CACHE_NAMESPACE); } $this->noOwnershipMetadata = new OwnershipMetadata(); }
protected function clearCacheDriver(CacheProvider $cacheDriver = null, $description = "") { if ($cacheDriver !== null) { $this->output .= 'Doctrine ' . $description . ' cache: ' . $cacheDriver->getNamespace() . ' — '; $this->output .= $cacheDriver->deleteAll() ? '<info>OK</info>' : '<info>FAIL</info>'; $this->output .= PHP_EOL; } }
public function __construct(\Doctrine\Common\Cache\CacheProvider $engine, $ttl = 3600, $prefix = null) { $this->time = time(); $this->serializer = new \Zumba\Util\JsonSerializer(); $this->engine = $engine; $this->default_ttl = $ttl; if (!$prefix) { $prefix = $engine->getNamespace(); } $this->prefix = $prefix; $this->auto_flush = true; }
/** * @param CacheProvider $cacheProvider */ public function setCacheProvider($cacheProvider) { $namespace = '[<>]' . rtrim($this->getName() . '|' . $cacheProvider->getNamespace(), '|') . '[<>]'; $arrayCache = new ArrayCache(); $cacheChain = new ChainCache([$arrayCache, $cacheProvider]); $cacheProvider = new Wrapper($cacheChain); $cacheProvider->setNamespace($namespace); $this->cacheProvider = $cacheProvider; $this->readConnection->setCacheProvider($cacheProvider); if ($this->writeConnection) { $this->writeConnection->setCacheProvider($cacheProvider); } }
/** * {@inheritdoc} */ public function getNamespace() { return $this->provider->getNamespace(); }