Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Cache][RateLimiter][FrameworkBundle] Redefining a framework-provided cache pool in config gets silently overwritten #44984

Copy link
Copy link
Closed
@Seldaek

Description

@Seldaek
Issue body actions

Symfony version(s) affected

5.3.x, probably earlier

Description

Framework-provided cache pools take priority over those defined in the cache config by user, and do so without warning.

How to reproduce

While setting up the rate limiter, I saw that it uses the cache.rate_limiter pool by default. This pool extends the cache.app one as per

->set('cache.rate_limiter')
->parent('cache.app')
->tag('cache.pool')

I wanted to make sure all rate limiters get stored somewhere else than the app cache, so it seemed obvious to me that I could redefine the cache.rate_limiter pool in the config and get this to be written somewhere else:

framework:
    cache:
        # [...]
        pools:
            cache.rate_limiter:
                adapter: cache.adapter.redis
                provider: '%redis_rate_limiter_dsn%'

Then a few months later I now realize this does not work at all. It seems like the service definition in FrameworkBundle/rate_limiter.php overwrites my cache pool silently, and so everything is still dumped in the app cache.

Possible Solution

A few alternatives I see to improve things:

  1. The best solution to me would be that if a pool is defined already then FrameworkBundle would not recreate that service.
  2. If redefining framework pools is frowned upon, then maybe the reserved list could be expanded a bit to include other cache.x pools.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.