How to autowire Symfony cache pools services?

In Symfony 4 and 5, we have the concept of cache pools. When we define new cache pool, a new service is generated for it using the name of the pool. The problem is that since they all share the same CacheInterface, Symfony wouldn’t know which service to inject if we rely solely on the interface.

My question is how to use autowire in the above case, to autowire a specific cache pool service to another service.

(I could inject the cache pool manually but if I can then I don’t want to).

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *