Skip to content

Commit e850831

Browse files
committed
Merge pull request #22 from Nyholm/bugfixes
bugfixes
2 parents aeca604 + 02a0646 commit e850831

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,15 @@ If you want to clear the cache you can run the following commands.
129129

130130
```sh
131131
php app/console cache:flush session
132-
php app/console cache:flush routing
132+
php app/console cache:flush router
133133
php app/console cache:flush doctrine
134134
135-
echo "Or you could run: "
135+
echo "Or you could run:"
136136
php app/console cache:flush all
137137
```
138138

139+
*Caution: If you are using a implementation that does not support tagging you will clear all with any of the above commands.*
140+
139141
### Need Help?
140142

141143
Create an issue if you've found a bug, or ping one of us on twitter: @aequasi or @TobiasNyholm

src/Command/CacheFlushCommand.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function configure()
4040
*/
4141
protected function execute(InputInterface $input, OutputInterface $output)
4242
{
43-
$validTypes = ['session', 'routing', 'doctrine'];
43+
$validTypes = ['session', 'router', 'doctrine'];
4444
$type = $input->getArgument('type');
4545
if ($type === 'all') {
4646
foreach ($validTypes as $type) {
@@ -67,10 +67,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
*/
6868
private function clearCacheForType($type)
6969
{
70-
$serviceId = $this->getContainer()->getParameter(sprintf('cache.%s%.service_id', $type));
70+
if (!$this->getContainer()->hasParameter(sprintf('cache.%s', $type))) {
71+
return;
72+
}
73+
74+
$config = $this->getContainer()->getParameter(sprintf('cache.%s', $type));
7175

7276
/** @type CacheItemPoolInterface $service */
73-
$service = $this->getContainer()->get($serviceId);
77+
$service = $this->getContainer()->get($config['service_id']);
7478
if ($service instanceof TaggablePoolInterface) {
7579
$service->clear([$type]);
7680
} else {

src/Routing/CachingRouter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function __call($method, $args)
164164
private function getCacheItemFromKey($key, $tag)
165165
{
166166
if ($this->cache instanceof TaggablePoolInterface) {
167-
$item = $this->cache->getItem($key, ['routing', $tag]);
167+
$item = $this->cache->getItem($key, ['router', $tag]);
168168
} else {
169169
$item = $this->cache->getItem($key);
170170
}

0 commit comments

Comments
 (0)