/** * Make sure set config works * */ public function testSetConfigShouldWork() { $config = new Zend_Config(array( 'default_backend' => 'File', 'frontend' => array( 'Core' => array('caching' => false) ), 'backend' => array( 'APC' => array(), 'File' => array('cache_dir' => '/tmp'), 'Sqlite' => array( 'cache_db_complete_path' => 'foo/bar.sqlite' ) ) )); Zym_Cache::setConfig($config); $this->assertEquals(Zym_Cache::getDefaultBackend(), 'File'); $this->assertEquals(Zym_Cache::getBackendOptions('Apc'), array()); $this->assertEquals(Zym_Cache::getBackendOptions('sqlite'), array( 'cache_db_complete_path' => 'foo/bar.sqlite' )); $this->assertEquals(Zym_Cache::getFrontendOptions('Core'), array('caching' => false)); }
/** * Setup * * @param Zend_Config $config * @return void */ public function setup(Zend_Config $config) { // Parse cache id prefix for application name via sprintf $config = $this->_parseCacheIdPrefix($config); Zym_Cache::setConfig($config); // Set file cache dir $this->_prependPath($config->get('backend')); }
/** * Setup mail * * @param Zend_Config $config */ public function setup(Zend_Config $config) { Zym_Cache::setConfig($config); // Set file cache dir $this->_prependPath($config->get('backend')); }
<?php $config = new Zend_Config(array('default_backend' => 'Apc', 'frontends' => array('core' => array('automatic_serialization' => true, 'cache_id_prefix' => 'MyAppPrefix_')), 'backends' => array('apc' => array(), 'file' => array('cache_dir' => '../tmp')))); Zym_Cache::setConfig($config);