Skip to content

[FrameworkBundle] Incompatible use of dynamic environment variables when configuring framework.cache.default_redis_provider #20850

Closed
@robinvdvleuten

Description

@robinvdvleuten

Hi there,

When I am trying to configure the default cache provider for the new cache implementation;

parameters:
    env(REDIS_URL): 'redis://localhost'

framework:
    cache:
        default_redis_provider: "%env(REDIS_URL)%"
        pools:
            cache.tickets:
                adapter: cache.adapter.redis
                default_lifetime: 300 # 5 minutes in seconds

I get the following exception when clearing the cache;

[Symfony\Component\DependencyInjection\Exception\EnvParameterException]             
Incompatible use of dynamic environment variables "REDIS_URL" found in parameters.
                                                                                                                                                                                    
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]                  
The service "cache.tickets" has a dependency on a non-existent service "%env(REDIS_URL)%".  

Which is a bit strange as it seems to look like a very good use case of using the new env functionality to me.

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