Created
December 12, 2011 23:03
-
-
Save eminetto/1469560 to your computer and use it in GitHub Desktop.
_initCache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Inicializa o cache | |
* | |
* @return void | |
* @author Elton Minetto | |
*/ | |
public function _initCache() | |
{ | |
$config = Zend_Registry::get('config')->cache; | |
$frontendOptions = array( | |
'lifetime' => $config->frontend->lifetime, // tempo de vida | |
'automatic_serialization' => $config->frontend->automatic_serialization | |
); | |
$backendOptions = $config->backend->options->toArray(); | |
// criando uma instancia do cache | |
$cache = Zend_Cache::factory('Core',//frontend | |
$config->backend->adapter, //backend | |
$frontendOptions, | |
$backendOptions); | |
/* | |
* Salva o cache no Registry para ser usado posteriormente | |
*/ | |
Zend_Registry::set('cache', $cache); | |
/* | |
* cache para metadados das tabelas | |
*/ | |
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment