Skip to content

Commit d0a6dd4

Browse files
committed
Merge pull request #17 from simensen/cache_namespaces
Allow for setting a cache namespace
2 parents 24be501 + 5d38146 commit d0a6dd4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Dflydev/Pimple/Provider/DoctrineOrm/DoctrineOrmServiceProvider.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Common\Cache\ApcCache;
1515
use Doctrine\Common\Cache\ArrayCache;
16+
use Doctrine\Common\Cache\CacheProvider;
1617
use Doctrine\Common\Cache\MemcacheCache;
1718
use Doctrine\Common\Cache\MemcachedCache;
1819
use Doctrine\Common\Cache\XcacheCache;
@@ -192,7 +193,13 @@ public function register(\Pimple $app)
192193
return $app[$cacheInstanceKey];
193194
}
194195

195-
return $app[$cacheInstanceKey] = $app['orm.cache.factory']($driver, $options[$cacheNameKey]);
196+
$cache = $app['orm.cache.factory']($driver, $options[$cacheNameKey]);
197+
198+
if(isset($options['cache_namespace']) && $cache instanceof CacheProvider) {
199+
$cache->setNamespace($options['cache_namespace']);
200+
}
201+
202+
return $app[$cacheInstanceKey] = $cache;
196203
});
197204

198205
$app['orm.cache.factory.backing_memcache'] = $app->protect(function() {

0 commit comments

Comments
 (0)