Esempio n. 1
0
 /**
  * Retrieve settings for all cache front-ends known to the system
  *
  * @return array Format: array('<frontend_id>' => array(<cache_settings>), ...)
  */
 protected function _getCacheSettings()
 {
     /*
      * Merging is intentionally implemented through array_merge() instead of array_replace_recursive()
      * to avoid "inheritance" of the default settings that become irrelevant as soon as cache storage type changes
      */
     $cacheInfo = $this->_deploymentConfig->getSegment(CacheConfig::CONFIG_KEY);
     if (null !== $cacheInfo) {
         $cacheConfig = new CacheConfig($cacheInfo);
         return array_merge($this->_frontendSettings, $cacheConfig->getCacheFrontendSettings());
     }
     return $this->_frontendSettings;
 }
Esempio n. 2
0
 /**
  * Retrieve cache frontend identifier, associated with a cache type
  *
  * @param string $cacheType
  * @return string
  */
 protected function _getCacheFrontendId($cacheType)
 {
     $result = null;
     $cacheInfo = $this->_deploymentConfig->getSegment(CacheConfig::CONFIG_KEY);
     if (null !== $cacheInfo) {
         $cacheConfig = new CacheConfig($cacheInfo);
         $result = $cacheConfig->getCacheTypeFrontendId($cacheType);
     }
     if (!$result) {
         if (isset($this->_typeFrontendMap[$cacheType])) {
             $result = $this->_typeFrontendMap[$cacheType];
         } else {
             $result = \Magento\Framework\App\Cache\Frontend\Pool::DEFAULT_FRONTEND_ID;
         }
     }
     return $result;
 }
 public function testGetData()
 {
     $object = new CacheConfig($this->data);
     $this->assertSame($this->data, $object->getData());
 }