Skip to content

Commit

Permalink
add apcu enabled check if apcu extension loaded (#10310)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksejs Kovalovs committed Dec 15, 2022
1 parent 83f6356 commit 8be4b72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/ORMSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private static function createCacheInstance(

$namespace = 'dc2_' . md5($proxyDir);

if (extension_loaded('apcu')) {
if (extension_loaded('apcu') && apcu_enabled()) {
return new ApcuAdapter($namespace);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Tools/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private static function createCacheInstance(bool $isDevMode, ?Cache $cache): Cac

if ($isDevMode === true) {
$cache = class_exists(ArrayCache::class) ? new ArrayCache() : new ArrayAdapter();
} elseif (extension_loaded('apcu')) {
} elseif (extension_loaded('apcu') && apcu_enabled()) {
$cache = class_exists(ApcuCache::class) ? new ApcuCache() : new ApcuAdapter();
} elseif (extension_loaded('memcached') && (class_exists(MemcachedCache::class) || MemcachedAdapter::isSupported())) {
$memcached = new Memcached();
Expand Down

0 comments on commit 8be4b72

Please sign in to comment.