Permalink
Browse files

Added support to redis, wincache and zend data cache.

  • Loading branch information...
1 parent 420f8c2 commit 9e35ced4cf11f88db6d0f84d89d95ce1be79b385 @guilhermeblanco guilhermeblanco committed Aug 9, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 DependencyInjection/AbstractDoctrineExtension.php
@@ -331,9 +331,24 @@ protected function loadObjectManagerCacheDriver(array $objectManager, ContainerB
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name'])), $memcachedInstance);
$cacheDef->addMethodCall('setMemcached', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManager['name'])))));
break;
+ case 'redis':
+ $redisClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.redis.class').'%';
+ $redisInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.redis_instance.class').'%';
+ $redisHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.redis_host').'%';
+ $redisPort = !empty($cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.redis_port').'%';
+ $cacheDef = new Definition($redisClass);
+ $redisInstance = new Definition($redisInstanceClass);
+ $redisInstance->addMethodCall('connect', array(
+ $redisHost, $redisPort
+ ));
+ $container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name'])), $redisInstance);
+ $cacheDef->addMethodCall('setRedis', array(new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManager['name'])))));
+ break;
case 'apc':
case 'array':
case 'xcache':
+ case 'wincache':
+ case 'zenddata':
$cacheDef = new Definition('%'.$this->getObjectManagerElementName(sprintf('cache.%s.class', $cacheDriver['type'])).'%');
break;
default:

0 comments on commit 9e35ced

Please sign in to comment.