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

2 participants
@alcaeus
Copy link
Member

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 added some commits Apr 6, 2019

@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 doctrine/team-symfony-integration Apr 6, 2019

@alcaeus alcaeus added this to 1.11 in Roadmap Apr 6, 2019

@nicolas-grekas
Copy link
Member

left a comment

LGTM, thanks!

@alcaeus alcaeus merged commit 8af32bd into doctrine:master Apr 7, 2019

2 checks passed

Scrutinizer 2 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@alcaeus alcaeus deleted the alcaeus:add-symfony-cache-pool-support branch Apr 7, 2019

@alcaeus alcaeus referenced this pull request Apr 15, 2019

Merged

Add new pool option to XSD #955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.