Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 public function testSetsOptionsTemplateUsingZendConfig()
 {
     $manager = new Cache\Manager();
     $config = array('frontend' => array('name' => 'Core', 'options' => array('automatic_serialization' => true)), 'backend' => array('name' => 'File', 'options' => array('cache_dir' => '../cache')));
     $manager->setCacheTemplate('myCache', new \Zend\Config\Config($config));
     $this->assertSame($config, $manager->getCacheTemplate('myCache'));
 }
Esempio n. 3
0
 public function testGettingPageCacheAlsoCreatesTagCache()
 {
     $manager = new Cache\Manager();
     $pagetagConfig = $manager->getCacheTemplate('pagetag');
     $pagetagConfig['backend']['options']['cache_dir'] = $this->getTmpDir();
     $manager->setCacheTemplate('pagetag', $pagetagConfig);
     $pagetag = $manager->getCache('page')->getBackend()->getOption('tag_cache');
     $this->assertTrue($pagetag instanceof Cache\Frontend);
 }