Skip to content

[Cache] Cannot configure chain adapter #32139

@Nyholm

Description

@Nyholm

Symfony version(s) affected: 3.4.x

Description
When trying to configure a cache ChainAdapter I get the following error:

Argument 1 passed to Symfony\Component\Cache\Adapter\ChainAdapter::__construct() must be of the type array, string given, called in /project/root/var/cache/dev/ContainerMdWoD6O/getCache_GlobalClearerService.php on line 20  

If I look in my container dump I see the following:

$this->services['cache.app'] = new \Symfony\Component\Cache\Adapter\ChainAdapter('y7VTFBCVw+', 2419200))

How to reproduce

composer create-project symfony/skeleton cache-issue

Add the following contents to cache.yaml:

framework:
    cache:
        # Put the unique name of your app here: the prefix seed
        # is used to compute stable namespaces for cache keys.
        #prefix_seed: your_vendor_name/app_name
        app: cache.chain
        pools:
            cache.chain:
                adapter: app.cache.adapter.chain

            cache.array:
                adapter: cache.adapter.array

            cache.apcu:
                adapter: cache.adapter.apcu


services:
    app.cache.adapter.chain:
        class: Symfony\Component\Cache\Adapter\ChainAdapter
        arguments:
            - [ '@cache.array', '@cache.apcu']
            - 2419200 # One month

Possible Solution
I've debugged some but I cannot figure out a good solution nor the cause.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions