getNamespace() public method

Retrieves the namespace that prefixes all cache ids.
public getNamespace ( ) : string
return string
コード例 #1
0
 /**
  * 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);
     }
 }
コード例 #2
0
 /**
  * @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);
     }
 }
コード例 #3
0
 /**
  * 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();
 }
コード例 #4
0
 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;
     }
 }
コード例 #5
0
ファイル: Cache.php プロジェクト: symforce/symforce-core
 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;
 }
コード例 #6
0
 /**
  * @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);
     }
 }
コード例 #7
0
ファイル: Cache.php プロジェクト: jacobjjc/PageKit-framework
 /**
  * {@inheritdoc}
  */
 public function getNamespace()
 {
     return $this->provider->getNamespace();
 }