Skip to content

Commit 8483864

Browse files
committed
Merge pull request #223 from FriendsOfSymfony/cleanup-tag-handling
Cleanup tag handling
2 parents 3138aee + c85809c commit 8483864

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

DependencyInjection/FOSHttpCacheExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public function load(array $configs, ContainerBuilder $container)
9191
$config['tags'],
9292
$this->getDefaultProxyClient($config['proxy_client'])
9393
);
94+
} else {
95+
$container->setParameter($this->getAlias().'.compiler_pass.tag_annotations', false);
9496
}
9597

9698
if ($config['invalidation']['enabled']) {
@@ -309,7 +311,7 @@ private function loadCacheTagging(ContainerBuilder $container, XmlFileLoader $lo
309311

310312
$container->setParameter($this->getAlias().'.compiler_pass.tag_annotations', true);
311313
$container->setParameter($this->getAlias().'.tag_handler.header', $config['header']);
312-
$loader->load('tag_listener.xml');
314+
$loader->load('cache_tagging.xml');
313315
if (!empty($config['rules'])) {
314316
$this->loadTagRules($container, $config['rules']);
315317
}

Resources/config/cache_manager.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<parameter key="fos_http_cache.event_listener.log.class">FOS\HttpCache\EventListener\LogSubscriber</parameter>
1010
<parameter key="fos_http_cache.command.invalidate_path.class">FOS\HttpCacheBundle\Command\InvalidatePathCommand</parameter>
1111
<parameter key="fos_http_cache.command.invalidate_regex.class">FOS\HttpCacheBundle\Command\InvalidateRegexCommand</parameter>
12-
<parameter key="fos_http_cache.command.invalidate_tag.class">FOS\HttpCacheBundle\Command\InvalidateTagCommand</parameter>
1312
<parameter key="fos_http_cache.command.refresh_path.class">FOS\HttpCacheBundle\Command\RefreshPathCommand</parameter>
1413
</parameters>
1514

@@ -44,11 +43,6 @@
4443
<tag name="console.command"/>
4544
</service>
4645

47-
<service id="fos_http_cache.command.invalidate_tag" class="%fos_http_cache.command.invalidate_tag.class%">
48-
<argument type="service" id="fos_http_cache.handler.tag_handler" />
49-
<tag name="console.command"/>
50-
</service>
51-
5246
<service id="fos_http_cache.command.refresh_path" class="%fos_http_cache.command.refresh_path.class%">
5347
<argument type="service" id="fos_http_cache.cache_manager" />
5448
<tag name="console.command"/>

Resources/config/tag_listener.xml renamed to Resources/config/cache_tagging.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<parameters>
88
<parameter key="fos_http_cache.event_listener.tag.class">FOS\HttpCacheBundle\EventListener\TagSubscriber</parameter>
9+
<parameter key="fos_http_cache.command.invalidate_tag.class">FOS\HttpCacheBundle\Command\InvalidateTagCommand</parameter>
910
</parameters>
1011

1112
<services>
@@ -19,10 +20,14 @@
1920
<tag name="twig.extension"/>
2021
</service>
2122

22-
<service id="fos_http_cache.event_listener.tag"
23-
class="%fos_http_cache.event_listener.tag.class%">
23+
<service id="fos_http_cache.event_listener.tag" class="%fos_http_cache.event_listener.tag.class%">
2424
<argument type="service" id="fos_http_cache.handler.tag_handler" />
2525
<tag name="kernel.event_subscriber" />
2626
</service>
27+
28+
<service id="fos_http_cache.command.invalidate_tag" class="%fos_http_cache.command.invalidate_tag.class%">
29+
<argument type="service" id="fos_http_cache.handler.tag_handler" />
30+
<tag name="console.command"/>
31+
</service>
2732
</services>
2833
</container>

Resources/doc/reference/configuration/tags.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ for an introduction.
77

88
.. include:: /includes/enabled.rst
99

10+
If you use a :doc:`proxy client that does not support banning </features/tagging>`,
11+
cache tagging is not possible. If you leave ``enabled`` on ``auto``, tagging will
12+
be deactivated.
13+
1014
Enables tag annotations and rules. If you want to use tagging, it is recommended
11-
that you set this to ``true`` so you are notified of missing dependencies:
15+
that you set this to ``true`` so you are notified of missing dependencies and
16+
incompatible proxies:
1217

1318
.. code-block:: yaml
1419

0 commit comments

Comments
 (0)