Cache zf conf & use doctrine cache service

pull/1/head
Thomas Metois 2016-11-07 16:41:36 +01:00
parent 4e381e8ea5
commit f705653802
3 changed files with 17 additions and 36 deletions

View File

@ -5,6 +5,7 @@
*
* @see https://github.com/zendframework/ZFTool
*/
$env = getenv('APP_ENV') ?: 'production';
return array(
'modules' => array(
'DoctrineModule',
@ -19,6 +20,12 @@ return array(
),
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php'
)
),
'config_cache_enabled' => ($env == 'production'),
'config_cache_key' => 'c8aaaaa11586f8b1bf5565cc6064e70a', // md5('config_cache_key_monarc')
'module_map_cache_enabled' => ($env == 'production'),
'module_map_cache_key' => '664579376c4dcdcaa0bcdd0f7e7bf25b', // md5('module_map_cache_key_monarc'),
'cache_dir' => 'data/cache/',
'check_dependencies' => ($env != 'production'),
),
);

View File

@ -5,6 +5,7 @@
*
* @see https://github.com/zendframework/ZFTool
*/
$env = getenv('APP_ENV') ?: 'production';
return array(
'modules' => array(
'DoctrineModule',
@ -19,6 +20,12 @@ return array(
),
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php'
)
),
'config_cache_enabled' => ($env == 'production'),
'config_cache_key' => 'c8aaaaa11586f8b1bf5565cc6064e70a', // md5('config_cache_key_monarc')
'module_map_cache_enabled' => ($env == 'production'),
'module_map_cache_key' => '664579376c4dcdcaa0bcdd0f7e7bf25b', // md5('module_map_cache_key_monarc'),
'cache_dir' => 'data/cache/',
'check_dependencies' => ($env != 'production'),
),
);

View File

@ -14,40 +14,7 @@ return array(
// DOCTRINE CONF
'service_manager' => array(
'factories' => array(
'doctrine.cache.mycache' => function(\Zend\ServiceManager\ServiceManager $sm){
$arrayCache = new \Doctrine\Common\Cache\ArrayCache();
if(getenv('APPLICATION_ENV') == 'production'){
if(extension_loaded('apc')){
$apcCache = new \Doctrine\Common\Cache\ApcCache();
$chainCache = new \Doctrine\Common\Cache\ChainCache([$apcCache,$arrayCache]);
return $chainCache;
}elseif(extension_loaded('apcu')){
$apcuCache = new \Doctrine\Common\Cache\ApcuCache();
$chainCache = new \Doctrine\Common\Cache\ChainCache([$apcuCache,$arrayCache]);
return $chainCache;
}
// TODO: untested / add param for memchache(d) host & port
/*elseif(extension_loaded('memcache')){
$memcache = new \Memcache();
if($memcache->connect('localhost', 11211)){
$cache = new \Doctrine\Common\Cache\MemcacheCache();
$cache->setMemcache($mem);
$chainCache = new \Doctrine\Common\Cache\ChainCache([$cache,$arrayCache]);
return $chainCache;
}
}elseif(extension_loaded('memcached')){
$memcache = new \Memcached();
if($memcache->connect('localhost', 11211)){
$cache = new \Doctrine\Common\Cache\MemcachedCache();
$cache->setMemcached($mem);
$chainCache = new \Doctrine\Common\Cache\ChainCache([$cache,$arrayCache]);
return $chainCache;
}
}*/
}
return $arrayCache;
},
'doctrine.cache.mycache' => 'MonarcCore\Service\DoctrineCacheServiceFactory',
),
),
'doctrine' => array(