From f15665f8c12470a8ead7a662e208f822f66e3909 Mon Sep 17 00:00:00 2001 From: Martin Bazik Date: Tue, 24 Jul 2012 10:51:16 +0200 Subject: [PATCH] cache configuration update --- Bazo/Extensions/Neo4j/DI/Neo4jExtension.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Bazo/Extensions/Neo4j/DI/Neo4jExtension.php b/Bazo/Extensions/Neo4j/DI/Neo4jExtension.php index 15ab717..8d2353b 100644 --- a/Bazo/Extensions/Neo4j/DI/Neo4jExtension.php +++ b/Bazo/Extensions/Neo4j/DI/Neo4jExtension.php @@ -16,9 +16,24 @@ class Neo4jExtension extends \Nette\Config\CompilerExtension */ public $defaults = array( 'host' => 'localhost', - 'port' => 7474 + 'port' => 7474, + 'cachePrefix' => 'neo4j', + 'metaDataCache' => 'array', + 'proxyDir' => '%appDir%/models/proxies' ); + private + $cacheClassMap = array( + 'array' => '\Doctrine\Common\Cache\ArrayCache', + 'apc' => '\Doctrine\Common\Cache\ApcCache', + 'filesystem' => '\Doctrine\Common\Cache\FilesystemCache', + 'phpFile' => '\Doctrine\Common\Cache\PhpFileCache', + 'winCache' => '\Doctrine\Common\Cache\WinCacheCache', + 'xcache' => '\Doctrine\Common\Cache\XcacheCache', + 'zendData' => '\Doctrine\Common\Cache\ZendDataCache' + ) + ; + /** * Processes configuration data * @@ -66,7 +81,7 @@ public static function createEntityManager(\Nette\DI\Container $container, $conf \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(VENDOR_DIR . '/hirevoice/neo4jphp-ogm/lib/HireVoice/Neo4j/Annotation/ManyToOne.php'); \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(VENDOR_DIR . '/hirevoice/neo4jphp-ogm/lib/HireVoice/Neo4j/Annotation/Property.php'); - $metadataCache = new $config['metaDataCacheClass']; + $metadataCache = new $this->cacheClassMap($config['metaDataCache']); $metadataCache->setNamespace($config['cachePrefix']); $reader = new \Doctrine\Common\Annotations\CachedReader(