Skip to content

Commit

Permalink
Deprecate cache.app configuration as tag aware
Browse files Browse the repository at this point in the history
  • Loading branch information
keulinho committed Nov 12, 2024
1 parent c15618b commit f2cb217
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion UPGRADE-7.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Cache
-----

* `igbinary_serialize()` is not used by default when the igbinary extension is installed
* Deprecate making `cache.app` pool taggable, use the `cache.app.taggable` pool instead
* Deprecate making `cache.app` tag aware, use the `cache.app.taggable` service instead

Console
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2389,18 +2389,23 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
}
}
foreach (['app', 'system'] as $name) {
if ('cache.adapter.redis_tag_aware' === $config[$name]) {
trigger_deprecation('symfony/framework-bundle', '7.2', sprintf(
'Using the "cache.adapter.redis_tag_aware" adapter for "cache.%s" is deprecated. You can use the "cache.app.taggable" service instead (aliased to the TagAwareCacheInterface for autowiring).',
$name
));
// throw new LogicException(sprintf(
// 'Using the "cache.adapter.redis_tag_aware" adapter for "cache.%s" is deprecated. You can use the "cache.app.taggable" service instead (aliased to the TagAwareCacheInterface for autowiring).',
// $name
// ));
}
$config['pools']['cache.'.$name] = [
'adapters' => [$config[$name]],
'public' => true,
'tags' => false,
];
}
foreach ($config['pools'] as $name => $pool) {
if ('cache.app' === $name && $pool['tags']) {
trigger_deprecation('symfony/framework-bundle', '7.2', 'Using the "tags" option with the "cache.app" pool is deprecated. You can use the "cache.app.taggable" pool instead (aliased to the TagAwareCacheInterface for autowiring).');
// throw new LogicException('The "tags" option cannot be used with the "cache.app" pool. You can use the "cache.app.taggable" pool instead (aliased to the TagAwareCacheInterface for autowiring).');
}

$pool['adapters'] = $pool['adapters'] ?: ['cache.app'];

$isRedisTagAware = ['cache.adapter.redis_tag_aware'] === $pool['adapters'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
'handle_all_throwables' => true,
'php_errors' => ['log' => true],
'cache' => [
'pools' => [
'cache.app' => [
'tags' => true,
],
],
'app' => 'cache.adapter.redis_tag_aware',
],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<framework:config http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:cache>
<framework:pool name="cache.app" tags="true" />
</framework:cache>
<framework:cache app="cache.adapter.redis_tag_aware"/>
</framework:config>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ framework:
php_errors:
log: true
cache:
pools:
cache.app:
tags: true
app: cache.adapter.redis_tag_aware
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ public function testCacheTaggableTagAppliedToPools()
*/
public function testTaggableCacheAppIsDeprecated()
{
$this->expectUserDeprecationMessage('Since symfony/framework-bundle 7.2: Using the "tags" option with the "cache.app" pool is deprecated. You can use the "cache.app.taggable" pool instead (aliased to the TagAwareCacheInterface for autowiring).');
$this->expectUserDeprecationMessage('Since symfony/framework-bundle 7.2: Using the "cache.adapter.redis_tag_aware" adapter for "cache.app" is deprecated. You can use the "cache.app.taggable" service instead (aliased to the TagAwareCacheInterface for autowiring).');

$this->createContainerFromFile('cache_cacheapp_tagaware');
}
Expand Down

0 comments on commit f2cb217

Please sign in to comment.