How to zend cache configuration:
Copy this to Bootstrap.php
protected function _initMyRoutes() {
// Disable auto buffer and instead leave it to the cache
Zend_Controller_Front::getInstance()->setParam('disableOutputBuffering', true);
$frontendOptionsCore = array(
'automatic_serialization' => true,
'lifetime' => 600
);
$frontendOptionsPage = array(
'automatic_serialization' => true,
'lifetime' => 600,
'default_options' => array(
'cache_with_get_variables' => true,
'cache_with_session_variables' => true,
'cache_with_cookie_variables' => true,
'make_id_with_get_variables' => true,
'make_id_with_session_variables' => true,
'make_id_with_cookie_variables' => false
)
);
$backendOptions = array('cache_dir' => APPLICATION_PATH . '/Cache');
$coreCache = Zend_Cache::factory('Core', 'File', $frontendOptionsCore, $backendOptions);
$pageCache = Zend_Cache::factory('Page', 'File', $frontendOptionsPage, $backendOptions);
// Start running the page cache immediately
$pageCache->start();
// Set global cache objects
Zend_Registry::set('coreCache', $coreCache);
Zend_Registry::set('pageCache', $pageCache);
// Start running the DB/Core cache
Zend_Db_Table_Abstract::setDefaultMetadataCache(Zend_Registry::get('coreCache'));
}
Comments :
0 comments to “Cache Your Zend Framework Config to Improve Performance, zend cache configuration”
Post a Comment