8000 Updated the Doctrine cache examples · symfony/symfony-docs@11c6c01 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11c6c01

Browse files
committed
Updated the Doctrine cache examples
1 parent 38a345e commit 11c6c01

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

reference/configuration/doctrine.rst

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -222,33 +222,35 @@ Keep in mind that you can't use both syntaxes at the same time.
222222
Caching Drivers
223223
~~~~~~~~~~~~~~~
224224

225-
.. deprecated:: 4.4
226-
227-
All the Doctrine caching types are deprecated since Symfony 4.4 and won't
228-
be available in Symfony 5.0 and higher. Replace them with either ``type: service``
229-
or ``type: pool`` and use any of the cache pools/services defined with
230-
:doc:`Symfony Cache </cache>`.
231-
232-
The built-in types of caching drivers are: ``array``, ``apc``, ``apcu``,
233-
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata`` and ``xcache``.
234-
There is a special type called ``service`` which lets you define the ID of your
235-
own caching service.
236-
237-
The following example shows an overview of the caching configurations:
225+
Use any of the existing :doc:`Symfony Cache </cache>` pools or define new pools
226+
to cache each of Doctrine ORM elements (queries, results, etc.):
238227

239228
.. code-block:: yaml
240229
230+
# config/packages/prod/doctrine.yaml
231+
framework:
232+
cache:
233+
pools:
234+
doctrine.result_cache_pool:
235+
adapter: cache.app
236+
doctrine.system_cache_pool:
237+
adapter: cache.system
238+
241239
doctrine:
242240
orm:
243-
auto_mapping: true
244-
# each caching driver type defines its own config options
245-
metadata_cache_driver: apc
241+
# ...
242+
metadata_cache_driver:
243+
type: pool
244+
pool: doctrine.system_cache_pool
245+
query_cache_driver:
246+
type: pool
247+
pool: doctrine.system_cache_pool
246248
result_cache_driver:
247-
type: memcache
248-
host: localhost
249-
port: 11211
250-
instance_class: Memcache
251-
# the 'service' type requires to define the 'id' option too
249+
type: pool
250+
pool: doctrine.result_cache_pool
251+
252+
# in addition to Symfony Cache pools, you can also use the
253+
# 'type: service' option to use any service as the cache
252254
query_cache_driver:
253255
type: service
254256
id: App\ORM\MyCacheService

0 commit comments

Comments
 (0)
0