diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 72d93297c1..74e6cd59f6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1601,6 +1601,7 @@ class FrameworkExtension extends Extension $version = new Parameter('container.build_id'); $container->getDefinition('cache.adapter.apcu')->replaceArgument(2, $version); + $container->getDefinition('cache.adapter.system')->replaceArgument(2, $version); $container->getDefinition('cache.adapter.filesystem')->replaceArgument(2, $config['directory']); if (isset($config['prefix_seed'])) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml index e0ada956e7..488cd868f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml @@ -35,16 +35,15 @@ - + + 0 + %kernel.cache_dir%/pools - true - - - + diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 4a0e7c386b..0e6970e740 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -94,6 +94,10 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg } /** + * Returns an ApcuAdapter if supported, a PhpFilesAdapter otherwise. + * + * Using ApcuAdapter makes system caches compatible with read-only filesystems. + * * @param string $namespace * @param int $defaultLifetime * @param string $version @@ -101,23 +105,15 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg * @param LoggerInterface|null $logger * * @return AdapterInterface - * - * @deprecated since Symfony 4.2 */ public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); - if (null === self::$apcuSupported) { self::$apcuSupported = ApcuAdapter::isSupported(); } - if (!self::$apcuSupported && null === self::$phpFilesSupported) { - self::$phpFilesSupported = PhpFilesAdapter::isSupported(); - } - - if (self::$phpFilesSupported) { - $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory); + if (!self::$apcuSupported) { + $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true); if (null !== $logger) { $opcache->setLogger($logger); } @@ -125,14 +121,6 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg return $opcache; } - $fs = new FilesystemAdapter($namespace, $defaultLifetime, $directory); - if (null !== $logger) { - $fs->setLogger($logger); - } - if (!self::$apcuSupported) { - return $fs; - } - $apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version); if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) { $apcu->setLogger(new NullLogger()); @@ -140,7 +128,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg $apcu->setLogger($logger); } - return new ChainAdapter(array($apcu, $fs)); + return $apcu; } public static function createConnection($dsn, array $options = array()) diff --git a/src/Symfony/Component/Cache/CHANGELOG.md b/src/Symfony/Component/Cache/CHANGELOG.md index f90ecbf3f2..b5723e4d61 100644 --- a/src/Symfony/Component/Cache/CHANGELOG.md +++ b/src/Symfony/Component/Cache/CHANGELOG.md @@ -12,7 +12,6 @@ CHANGELOG * added automatic table creation when using Doctrine DBAL with PDO-based backends * throw `LogicException` when `CacheItem::tag()` is called on an item coming from a non tag-aware pool * deprecated `CacheItem::getPreviousTags()`, use `CacheItem::getMetadata()` instead - * deprecated the `AbstractAdapter::createSystemCache()` method * deprecated the `AbstractAdapter::unserialize()` and `AbstractCache::unserialize()` methods * added `CacheCollectorPass` (originally in `FrameworkBundle`) * added `CachePoolClearerPass` (originally in `FrameworkBundle`)