I'ld like to use the new Symfony 3 Cache Component in a project. I can use it if I define my services by hand like this:
app.cache.adapter.array:
class: 'Symfony\Component\Cache\Adapter\ArrayAdapter'
app.redis.client:
class: Predis\Client
factory: ['Symfony\Component\Cache\Adapter\RedisAdapter', 'createConnection']
arguments: ["%redis_dsn%", {timeout: 5}]
app.cache.adapter.redis:
class: Symfony\Component\Cache\Adapter\RedisAdapter
abstract: true
arguments:
-
- "api"
- 0
app.cache.adapter.chain:
class: 'Symfony\Component\Cache\Adapter\ChainAdapter'
abstract: true
arguments:
- ['@app.cache.adapter.array', "@app.cache.adapter.redis"]
- 0
cache.api:
parent: "app.cache.adapter.chain"
But as soon as I use the cache.pool tag or the framework pools configuration to get data in the profiler, I've got an exception
framework:
cache:
pools:
cache.api:
adapter: "app.cache.adapter.chain"
public: true
default_lifetime: 0
clearer: ~
And here is the exception
(1/1) ContextErrorException
Catchable Fatal Error: Argument 1 passed to Symfony\Component\Cache\Adapter\ChainAdapter::__construct() must be of the type array, string given, called in /var/www/julien/htdocs/sccd/website/var/cache/dev/appDevDebugProjectContainer.php on line 4032 and defined
in ChainAdapter.php (line 37)
at ChainAdapter->__construct('+FJMe7Pj5l', 0)in appDevDebugProjectContainer.php (line 4032)
at appDevDebugProjectContainer->getCache_Api_RecorderInnerService()in appDevDebugProjectContainer.php (line 623)
at appDevDebugProjectContainer->getCache_ApiService()in classes.php (line 3292)
at Container->get('cache.api')in appDevDebugProjectContainer.php (line 2629)
Can anyone help me on this ?
I'm using the Symfony v3.3.11, and predis/predis v1.1.1 for redis connection.
Thanks