You are not logged in.
Pages: 1
I have insert on bootstrap this function and variable for cache:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public $cahce ;
protected function _initCache()
{
// Cache options
$frontendOptions = array(
'lifetime' => 86400*2, // Cache lifetime of 20 minutes
'automatic_serialization' => true,
'cache_id_prefix' => 'meme',
);
$backendOptions = array(
'cache_dir' => '../application/meme-tmp/', // Directory where to put the cache files
);
//se non è abilitato APC usa file
$backend = extension_loaded('apc') ? 'Apc' : 'File';
// Get a Zend_Cache_Core object
$this->cache = Zend_Cache::factory('Core', $backend, $frontendOptions, $backendOptions);
//Zend_Db_Table_Abstract::setDefaultMetadataCache($this->cache);
}can i read the variable $cache from the models ??
Offline
hey Alessio,
you could store the variable in Zend_Registry and pick it up on the other side, or create a singleton and then call a getInstance() method on it... Alternatively, I believe if you return $this->cache, you can pick it up as an environment argument in your controller and pass it into your model that way. A singleton is probably the best way to go... e.g. MyApp_CacheFactory::getInstance()
my 2 cents,
-
Jon
Offline
Pages: 1