-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] fix warming up cache.system and apcu #30331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -94,7 +94,7 @@ function ($deferred, $namespace, &$expiredIds) use ($getId) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* Returns an ApcuAdapter if supported, a PhpFilesAdapter otherwise. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* Returns the best possible adapter that your runtime supports. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* Using ApcuAdapter makes system caches compatible with read-only filesystems. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -108,16 +108,12 @@ function ($deferred, $namespace, &$expiredIds) use ($getId) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (null === self::$apcuSupported) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
self::$apcuSupported = ApcuAdapter::isSupported(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, unconditional is simpler and we don't care if you don't have opcache :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but, if the user does not have opcache or apcu, then you get no caching at all? possible hard to debug? up to the user to manually configure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just looked at it does sort of fallback to filesystem in 4.1 FYI symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php Lines 89 to 123 in a57ce22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you don't have opcache, you don't care about that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no opcache means you will still have the cache - but php will parse the files all the time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah yes! gotcha. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (null !== $logger) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$opcache->setLogger($logger); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!self::$apcuSupported) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (null !== $logger) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$opcache->setLogger($logger); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!self::$apcuSupported = self::$apcuSupported ?? ApcuAdapter::isSupported()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return $opcache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -128,7 +124,7 @@ public static function createSystemCache($namespace, $defaultLifetime, $version, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$apcu->setLogger($logger); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return $apcu; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return new ChainAdapter([$apcu, $opcache]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
public static function createConnection($dsn, array $options = []) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not seem to be precise anymore.