Skip to content

Commit 7cac21a

Browse files
committed
Merge pull request #56 from Nyholm/patch
[WIP]
2 parents e51df01 + 6f82799 commit 7cac21a

File tree

7 files changed

+18
-68
lines changed

7 files changed

+18
-68
lines changed

src/Command/CacheFlushCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
namespace Aequasi\Bundle\CacheBundle\Command;
1010

11+
use Psr\Cache\CacheItemPoolInterface;
1112
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
12-
use Aequasi\Bundle\CacheBundle\Service\CacheService;
1313
use Symfony\Component\Console\Input\InputInterface;
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use Symfony\Component\Console\Input\InputArgument;
@@ -37,10 +37,10 @@ protected function configure()
3737
*/
3838
protected function execute(InputInterface $input, OutputInterface $output)
3939
{
40-
$serviceName = 'aequasi_cache.instance.' . $input->getArgument('instance');
40+
$serviceName = sprintf('aequasi_cache.instance.%s.bridge', $input->getArgument('instance'));
4141

42-
/** @var CacheService $service */
42+
/** @var CacheItemPoolInterface $service */
4343
$service = $this->getContainer()->get($serviceName);
44-
$service->flushAll();
44+
$service->clear();
4545
}
4646
}

src/DependencyInjection/Builder/ServiceBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function buildService($typeId, $name, array $instance)
100100
->setPublic(false);
101101

102102
// Create the CacheItemPoolInterface object, Logging or not
103-
$service = $this->container->setDefinition(
103+
$this->container->setDefinition(
104104
$serviceId,
105105
new Definition($this->getCachePoolClassName(), [new Reference($coreName)])
106106
);

src/DependencyInjection/Compiler/DoctrineSupportCompilerPass.php

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ protected function enableDoctrineSupport(array $config)
6565
$manager,
6666
$cacheType
6767
);
68+
69+
// Replace the doctrine entity manager cache with our bridge
6870
$this->container->setAlias($doctrineDefinitionName, $cacheDefinitionName);
6971
}
7072
}

src/DependencyInjection/Compiler/RouterCompilerPass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ protected function prepare()
3232

3333
$def = $this->container->findDefinition('router');
3434
$def->setClass('Aequasi\Bundle\CacheBundle\Routing\Router');
35-
$def->addMethodCall('setCache', [new Reference('aequasi_cache.instance.' . $instance)]);
35+
$def->addMethodCall('setCache', [new Reference(sprintf('aequasi_cache.instance.%s.bridge', $instance))]);
3636
}
3737
}

src/Exception/BadMethodException.php

-21
This file was deleted.

src/Exception/InvalidArgumentException.php

-19
This file was deleted.

src/Resources/config/services.yml

+10-22
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,41 @@
1-
parameters:
2-
aequasi_cache.abstract.apc.class: Doctrine\Common\Cache\ApcCache
3-
aequasi_cache.abstract.array.class: Doctrine\Common\Cache\ArrayCache
4-
aequasi_cache.abstract.file_system.class: Doctrine\Common\Cache\FilesystemCache
5-
aequasi_cache.abstract.memcache.class: Doctrine\Common\Cache\MemcacheCache
6-
aequasi_cache.abstract.memcached.class: Doctrine\Common\Cache\MemcachedCache
7-
aequasi_cache.abstract.redis.class: Doctrine\Common\Cache\RedisCache
8-
aequasi_cache.abstract.php_file.class: Doctrine\Common\Cache\PhpFileCache
9-
aequasi_cache.abstract.win_cache.class: Doctrine\Common\Cache\WinCacheCache
10-
aequasi_cache.abstract.xcache.class: Doctrine\Common\Cache\XcacheCache
11-
aequasi_cache.abstract.zend_data.class: Doctrine\Common\Cache\ZendDataCache
12-
aequasi_cache.session.handler.class: Aequasi\Bundle\CacheBundle\Session\SessionHandler
131

142
services:
153
aequasi_cache.abstract.apc:
16-
class: %aequasi_cache.abstract.apc.class%
4+
class: Doctrine\Common\Cache\ApcCache
175
abstract: true
186

197
aequasi_cache.abstract.array:
20-
class: %aequasi_cache.abstract.array.class%
8+
class: Doctrine\Common\Cache\ArrayCache
219
abstract: true
2210

2311
aequasi_cache.abstract.file_system:
24-
class: %aequasi_cache.abstract.file_system.class%
12+
class: Doctrine\Common\Cache\FilesystemCache
2513
abstract: true
2614

2715
aequasi_cache.abstract.memcache:
28-
class: %aequasi_cache.abstract.memcache.class%
16+
class: Doctrine\Common\Cache\MemcacheCache
2917
abstract: true
3018

3119
aequasi_cache.abstract.memcached:
32-
class: %aequasi_cache.abstract.memcached.class%
20+
class: Doctrine\Common\Cache\MemcachedCache
3321
abstract: true
3422

3523
aequasi_cache.abstract.redis:
36-
class: %aequasi_cache.abstract.redis.class%
24+
class: Doctrine\Common\Cache\RedisCache
3725
abstract: true
3826

3927
aequasi_cache.abstract.php_file:
40-
class: %aequasi_cache.abstract.php_file.class%
28+
class: Doctrine\Common\Cache\PhpFileCache
4129
abstract: true
4230

4331
aequasi_cache.abstract.win_cache:
44-
class: %aequasi_cache.abstract.win_cache.class%
32+
class: Doctrine\Common\Cache\WinCacheCache
4533
abstract: true
4634

4735
aequasi_cache.abstract.xcache:
48-
class: %aequasi_cache.abstract.xcache.class%
36+
class: Doctrine\Common\Cache\XcacheCache
4937
abstract: true
5038

5139
aequasi_cache.zend_data:
52-
class: %aequasi_cache.abstract.zend_data.class%
40+
class: Doctrine\Common\Cache\ZendDataCache
5341
abstract: true

0 commit comments

Comments
 (0)