Description
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
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:
- The best solution to me would be that if a pool is defined already then FrameworkBundle would not recreate that service.
- 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