Cache zf conf & use doctrine cache service
parent
4e381e8ea5
commit
f705653802
|
@ -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'),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue