Doctrine Caching for Jackalope Doctrine DBAL
1.3 version
Maintained
Unmaintained
Doctrine Caching for Jackalope Doctrine DBAL¶
Jackalope Doctrine DBAL gets better performance when running it with the DoctrineCacheBundle:
1 | $ composer require doctrine/doctrine-cache-bundle:1.0.*
|
And adding the following entry to your app/AppKernel.php
:
// app/AppKernel.php
// ...
public function registerBundles()
{
$bundles = array(
// ...
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
);
// ...
}
Configure a doctrine_cache
section in your main configuration file and add
a caches section to doctrine_phpcr.session.backend
:
- YAML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# app/config/config.yml doctrine_cache: providers: phpcr_meta: type: file_system phpcr_nodes: type: file_system doctrine_phpcr: session: backend: # ... caches: meta: doctrine_cache.providers.phpcr_meta nodes: doctrine_cache.providers.phpcr_nodes
- XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<!-- app/config/config.xml --> <?xml version="1.0" encoding="UTF-8" ?> <container xmlns="http://symfony.com/schema/dic/services"> <config xmlns="http://doctrine-project.org/schema"> <provider name="phpcr_meta" type="file_system"/> <provider name="phpcr_nodes" type="file_system"/> </config> <config xmlns="http://doctrine-project.org/schema/symfony-dic/odm/phpcr"> <session> <backend> <!-- ... --> <caches meta="doctrine_cache.providers.phpcr_meta" nodes="doctrine_cache.providers.phpcr_nodes" > </backend> </session> </config> </container>
- PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
// app/config/config.php $container->loadFromExtension('doctrine_cache', array( 'providers' => array( 'phpcr_meta' => array( 'type' => 'file_system', ), 'phpcr_nodes' => array( 'type' => 'file_system', ), ), ); $container->loadFromExtension('doctrine_phpcr', array( 'session' => array( 'backend' => array( // ... 'caches' => array( 'meta' => 'doctrine_cache.providers.phpcr_meta', 'nodes' => 'doctrine_cache.providers.phpcr_nodes', ), ), ), );
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.