/** * Retrieve Zend_Cache_Manager instance * * @return Zend_Cache_Manager */ public function getCacheManager() { if (null === $this->_manager) { $this->_manager = new Zend_Cache_Manager(); $options = $this->getOptions(); if (!App_Filesystem_Folder::exists($options['page']['backend']['options']['cache_dir'])) { if (App_Filesystem_Folder::create($options['page']['backend']['options']['cache_dir'])) { $getout = fopen($options['page']['backend']['options']['cache_dir'] . "/index.html", "w") or die("Unable to open file!"); fwrite($getout, "Get out\n"); fclose($getout); } else { } } if (!App_Filesystem_Folder::exists($options['database']['backend']['options']['cache_dir'])) { if (App_Filesystem_Folder::create($options['database']['backend']['options']['cache_dir'])) { $getout = fopen($options['database']['backend']['options']['cache_dir'] . "/index.html", "w") or die("Unable to open file!"); fwrite($getout, "Get out\n"); fclose($getout); } else { } } foreach ($options as $key => $value) { if ($this->_manager->hasCacheTemplate($key)) { $this->_manager->setTemplateOptions($key, $value); } else { $this->_manager->setCacheTemplate($key, $value); } } } return $this->_manager; }
/** * Retrieve Zend_Cache_Manager instance * * @return Zend_Cache_Manager */ public function getCacheManager() { if (null === $this->_manager) { $this->_manager = new Zend_Cache_Manager(); $options = $this->getOptions(); foreach ($options as $key => $value) { if ($this->_manager->hasCacheTemplate($key)) { $this->_manager->setTemplateOptions($key, $value); } else { $this->_manager->setCacheTemplate($key, $value); } } } return $this->_manager; }
/** * Retrieve Zend_Cache_Manager instance * * @return Zend_Cache_Manager */ public function getCacheManager() { if (null === $this->_manager) { $this->_manager = new Zend_Cache_Manager(); $options = $this->getOptions(); foreach ($options as $key => $value) { // Logger if (isset($value['frontend']['options']['logger'])) { $logger = $value['frontend']['options']['logger']; if (is_array($logger)) { $value['frontend']['options']['logger'] = Zend_Log::factory($logger); } } // Cache templates if ($this->_manager->hasCacheTemplate($key)) { $this->_manager->setTemplateOptions($key, $value); } else { $this->_manager->setCacheTemplate($key, $value); } } } return $this->_manager; }
/** * Create cache manager service * * @param ServiceLocatorInterface $serviceLocator * @return CacheManager * @throws Exception\RuntimeException */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('Config'); if (!isset($config['cache_manager'])) { throw new Exception\RuntimeException('No cache manager config found.'); } $options = $config['cache_manager']; $manager = new CacheManager(); foreach ($options as $key => $value) { if ($manager->hasCacheTemplate($key)) { $manager->setTemplateOptions($key, $value); } else { $manager->setCacheTemplate($key, $value); } } return $manager; }