Skip to content

[Cache] ChainAdapter with custom namespace #60579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
IndraGunawan opened this issue May 29, 2025 · 0 comments
Open

[Cache] ChainAdapter with custom namespace #60579

IndraGunawan opened this issue May 29, 2025 · 0 comments

Comments

@IndraGunawan
Copy link
Contributor

IndraGunawan commented May 29, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants