Skip to content

Commit a88a534

Browse files
committed
Modify apcu check in getDoctrineAnnotationReader() to use 'apcu_enabled' function
1 parent 9cfa27b commit a88a534

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/SchemaFactory.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,12 @@ private function getDoctrineAnnotationReader(): Reader
222222
AnnotationRegistry::registerLoader('class_exists');
223223
$doctrineAnnotationReader = new DoctrineAnnotationReader();
224224

225-
$cacheDir = $this->annotationCacheDir ?? sys_get_temp_dir();
226-
$cache = function_exists('apcu_fetch') ? new ApcuCache() : new PhpFileCache($cacheDir . '/graphqlite.' . crc32(__DIR__));
225+
if (function_exists('apcu_enabled') && apcu_enabled()) {
226+
$cache = new ApcuCache();
227+
} else {
228+
$cacheDir = $this->annotationCacheDir ?? sys_get_temp_dir();
229+
$cache = new PhpFileCache($cacheDir . '/graphqlite.' . crc32(__DIR__));
230+
}
227231

228232
$cache->setNamespace($this->cacheNamespace);
229233

0 commit comments

Comments
 (0)