You are browsing a version that is no longer maintained.

DoctrineCacheBundle

Since the version 1.3 of DoctrineBundle the DoctrineCacheBundle is included by default.

The DoctrineCacheBundle is used to allow different systems of cache in your application using the Doctrine Cache library.

Setup and Configuration

Doctrine cache for Symfony is maintained in the DoctrineCacheBundle. The bundle uses external Doctrine Cache library.

Follow these steps to install the bundle and the library in the Symfony Standard edition. Add the following to your composer.json file:

1{ "require": { "doctrine/doctrine-cache-bundle": "1.0.*" } }
2
3
4
5

Update the vendor libraries:

$ php composer.phar update doctrine/doctrine-cache-bundle

If everything worked, the DoctrineCacheBundle can now be found at vendor/doctrine/doctrine-cache-bundle.

DoctrineCacheBundle installs Doctrine Cache library. The library can be found at vendor/doctrine/cache.

Finally, register the Bundle DoctrineCacheBundle in app/AppKernel.php.

1// ... public function registerBundles() { $bundles = array( // ... new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), ); // ... }
2
3
4
5
6
7
8
9
10
11

ORM caching configuration

Some configurations of the ORM can use cache to prevent an excessive number of requests, read the Caching Drivers.

1# app/config/config.yml doctrine: orm: metadata_cache_driver: # will load doctrine_cache.providers.metadata_cache_driver cache_provider: metadata_cache_driver query_cache_driver: cache_provider: query_cache_driver result_cache_driver: # if you're using a version < 1.3 of the DoctrineBundle # you can use the "service" type type: service id: doctrine_cache.providers.result_cache_driver doctrine_cache: providers: metadata_cache_driver: type: apc query_cache_driver: type: apc result_cache_driver: type: apc
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22