Ejemplo n.º 1
0
 /**
  * @return Centurion_Cache_Manager
  */
 public function getCacheManager()
 {
     if (null === $this->_manager) {
         $this->_manager = new Centurion_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);
             }
         }
     }
     Zend_Registry::set('Cache_Manager', $this->_manager);
     return parent::getCacheManager();
 }
Ejemplo n.º 2
0
 /**
  * 扩展父类功能,设置默认缓存。
  */
 public function getCacheManager()
 {
     if (null != ($cacheManager = parent::getCacheManager())) {
         // 设置图表数据的缓存
         if ($cacheManager->hasCache('chart')) {
             ZtChart_Model_Assemble::setCache($cacheManager->getCache('chart'));
         }
         // 设置权限控制数据的缓存
         if ($cacheManager->hasCache('acl')) {
             ZtChart_Model_Acl_Loader::setCache($cacheManager->getCache('acl'));
         }
         // 设置IP数据的缓存
         if ($cacheManager->hasCache('ip')) {
             ZtChart_Model_Assemble_Ip::setCache($cacheManager->getCache('ip'));
         }
     }
     return $cacheManager;
 }
 /**
  * @group GH-103
  */
 public function testLoggerFactory()
 {
     $options = array('page' => array('frontend' => array('options' => array('logging' => true, 'logger' => array(new Zend_Log_Writer_Mock())))));
     $resource = new Zend_Application_Resource_Cachemanager($options);
     $resource->setBootstrap($this->bootstrap);
     $resource->init();
     $page = $resource->getCacheManager()->getCache('page');
     $page->getBackend()->clean(Zend_Cache::CLEANING_MODE_OLD);
     $event = current($options['page']['frontend']['options']['logger'][0]->events);
     $this->assertTrue(is_array($event));
     $this->assertTrue(array_key_exists('message', $event));
     $this->assertContains('Zend_Cache_Backend_Static', $event['message']);
 }
Ejemplo n.º 4
0
 /**
  * Initialize Cache_Manager
  *
  * @return Zend_Cache_Manager
  */
 public function init()
 {
     $cacheManager = parent::getCacheManager();
     Zend_Registry::set('cache_manager', $cacheManager);
     return $cacheManager;
 }