Merge pull request #321 from import/feature/newCacheDriver
Addition for new cache driver
This commit is contained in:
commit
d6ccd82cf6
@ -165,19 +165,24 @@ class Setup
|
|||||||
$proxyDir = $proxyDir ?: sys_get_temp_dir();
|
$proxyDir = $proxyDir ?: sys_get_temp_dir();
|
||||||
if ($isDevMode === false && $cache === null) {
|
if ($isDevMode === false && $cache === null) {
|
||||||
if (extension_loaded('apc')) {
|
if (extension_loaded('apc')) {
|
||||||
$cache = new \Doctrine\Common\Cache\ApcCache;
|
$cache = new \Doctrine\Common\Cache\ApcCache();
|
||||||
} else if (extension_loaded('xcache')) {
|
} else if (extension_loaded('xcache')) {
|
||||||
$cache = new \Doctrine\Common\Cache\XcacheCache;
|
$cache = new \Doctrine\Common\Cache\XcacheCache();
|
||||||
} else if (extension_loaded('memcache')) {
|
} else if (extension_loaded('memcache')) {
|
||||||
$memcache = new \Memcache();
|
$memcache = new \Memcache();
|
||||||
$memcache->connect('127.0.0.1');
|
$memcache->connect('127.0.0.1');
|
||||||
$cache = new \Doctrine\Common\Cache\MemcacheCache();
|
$cache = new \Doctrine\Common\Cache\MemcacheCache();
|
||||||
$cache->setMemcache($memcache);
|
$cache->setMemcache($memcache);
|
||||||
|
} else if (extension_loaded('redis')) {
|
||||||
|
$redis = new \Redis();
|
||||||
|
$redis->connect('127.0.0.1');
|
||||||
|
$cache = new \Doctrine\Common\Cache\RedisCache();
|
||||||
|
$cache->setRedis($redis);
|
||||||
} else {
|
} else {
|
||||||
$cache = new ArrayCache;
|
$cache = new ArrayCache();
|
||||||
}
|
}
|
||||||
} else if ($cache === null) {
|
} else if ($cache === null) {
|
||||||
$cache = new ArrayCache;
|
$cache = new ArrayCache();
|
||||||
}
|
}
|
||||||
$cache->setNamespace("dc2_" . md5($proxyDir) . "_"); // to avoid collisions
|
$cache->setNamespace("dc2_" . md5($proxyDir) . "_"); // to avoid collisions
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user