8000 [Cache] fix warming up cache.system and apcu · symfony/symfony@70b6994 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70b6994

Browse files
[Cache] fix warming up cache.system and apcu
1 parent 424773d commit 70b6994

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,12 @@ function ($deferred, $namespace, &$expiredIds) use ($getId) {
108108
*/
109109
public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null)
110110
{
111-
if (null === self::$apcuSupported) {
112-
self::$apcuSupported = ApcuAdapter::isSupported();
111+
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true);
112+
if (null !== $logger) {
113+
$opcache->setLogger($logger);
113114
}
114115

115-
if (!self::$apcuSupported) {
116-
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true);
117-
if (null !== $logger) {
118-
$opcache->setLogger($logger);
119-
}
120-
116+
if (!self::$apcuSupported = self::$apcuSupported ?? ApcuAdapter::isSupported()) {
121117
return $opcache;
122118
}
123119

@@ -128,7 +124,7 @@ public static function createSystemCache($namespace, $defaultLifetime, $version,
128124
$apcu->setLogger($logger);
129125
}
130126

131-
return $apcu;
127+
return new ChainAdapter([$apcu, $opcache]);
132128
}
133129

134130
public static function createConnection($dsn, array $options = [])

0 commit comments

Comments
 (0)
0