Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Cache] ChainAdapter with custom namespace #60579

Open
@IndraGunawan

Description

@IndraGunawan

Symfony version(s) affected

7.2.6

Description

i tried to have a chain pool with array and redis adapters and expected to have a specific namespace when the cache is stored in redis, with the following steps i get below error.

!!  In Definition.php line 295:
!!                                                                                 
!!    The argument "0" doesn't exist in class "Symfony\Component\Cache\Adapter\ChainAdapter".  

How to reproduce

# services.yaml
services:
     _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true
    my_cache.chain:
        class: Symfony\Component\Cache\Adapter\ChainAdapter
        arguments:
            - [ '@cache.adapter.array', '@cache.adapter.redis' ]
        tags:
            - { name: cache.pool, namespace: 'my-custom-ns' }
# cache.yaml
framework:
    cache:
        pools:
            my_chain_pool:
                adapter: my_cache.chain

i have tried this way as well but the namepace is still a hash

# services.yaml
services:
    my_redis.adapter:
        parent: 'cache.adapter.redis'
        tags:
            - { name: cache.pool, namespace: 'my-custom-ns' }
# cache.yaml
framework:
    cache:
        pools:
            my_chain_pool:
                adapters: [cache.adapter.array, my_redis.adapter]

Possible Solution

No response

Additional Context

No response

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