Skip to content

Commit

Permalink
cache configuration update
Browse files Browse the repository at this point in the history
  • Loading branch information
bazo committed Jul 24, 2012
1 parent 3ac889a commit f15665f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Bazo/Extensions/Neo4j/DI/Neo4jExtension.php
Expand Up @@ -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
*
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit f15665f

Please sign in to comment.