Symfony public bundle, best practices for cache using inside bundle

I moving into bundle logic that common for several projects. And it is using a caching. How can I use cache in bundle in optimal way?

To clarify: I have services.xml in my bundle and doctrine.orm.entity_manager as argument for bundle’s service. It is easy – entity_manager is always a entity manager. I want add cache as constructor argument. But here we have a lot of options: file system cache, redis or memcache with different pools etc and I want pass as argument one of them.

I looked here: Constructor Arguments but was unable achive desired result, or here: Processing the $configs Array, i just don’t have definitions of cache services at this point.

So, how can I configure which of caches I want to use?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

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