Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add symfony cache pool support #948

Merged
merged 2 commits into from Apr 7, 2019

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Apr 6, 2019

This PR adds support for using a symfony/cache pool directly without having to create extra services. It makes the default configuration from the recipe a lot shorter:

 doctrine:
     orm:
         auto_generate_proxy_classes: false
         metadata_cache_driver:
-            type: service
-            id: doctrine.system_cache_provider
+            type: pool
+            pool: doctrine.system_cache_pool
         query_cache_driver:
-            type: service
-            id: doctrine.system_cache_provider
+            type: pool
+            pool: doctrine.system_cache_pool
         result_cache_driver:
-            type: service
-            id: doctrine.result_cache_provider
+            type: pool
+            pool: doctrine.result_cache_pool
 
-services:
-    doctrine.result_cache_provider:
-        class: Symfony\Component\Cache\DoctrineProvider
-        public: false
-        arguments:
-            - '@doctrine.result_cache_pool'
-    doctrine.system_cache_provider:
-        class: Symfony\Component\Cache\DoctrineProvider
-        public: false
-        arguments:
-            - '@doctrine.system_cache_pool'
-
 framework:
     cache:
         pools:
             doctrine.result_cache_pool:
                 adapter: cache.app
             doctrine.system_cache_pool:
                 adapter: cache.system

The added normalisation step in Configuration is to add a type field to the cache configuration when using the cache_provider setting for DoctrineCacheBundle. This makes the entire block of creating the correct cache alias simpler.

With this PR, using the new pool setting is optional, as is the dependency on symfony/cache. In a future PR, we'll be deprecating support for declaring caches through DoctrineCacheBundle, leaving only the id and pool cache types. Support for DoctrineCacheBundle will be dropped in DoctrineBundle 2.0.

This PR was created during the Symfony Hackathon sponsored by the EU-FOSSA 2 program.

@alcaeus alcaeus added the Feature label Apr 6, 2019
@alcaeus alcaeus added this to the 1.11.0 milestone Apr 6, 2019
@alcaeus alcaeus self-assigned this Apr 6, 2019
@alcaeus alcaeus requested a review from a team April 6, 2019 18:21
@alcaeus alcaeus added this to 1.11 in Roadmap Apr 6, 2019
@alcaeus alcaeus added the ⭐️ EUFOSSA Hackathon https://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-coming label Apr 7, 2019
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@alcaeus alcaeus merged commit 8af32bd into doctrine:master Apr 7, 2019
@alcaeus alcaeus deleted the add-symfony-cache-pool-support branch April 7, 2019 18:36
@Koc
Copy link
Contributor

Koc commented May 10, 2019

@alcaeus will you update default recipe for that change?

@alcaeus
Copy link
Member Author

alcaeus commented May 10, 2019

That change will come in the next few days 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐️ EUFOSSA Hackathon https://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-coming Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants