1313
1414use Cache \Adapter \Memcached \MemcachedCachePool ;
1515use Cache \AdapterBundle \ProviderHelper \Memcached ;
16+ use Cache \Namespaced \NamespacedCachePool ;
1617use Symfony \Component \OptionsResolver \OptionsResolver ;
1718
1819/**
@@ -32,7 +33,13 @@ public function getAdapter(array $config)
3233 $ client = new Memcached ($ config ['persistent_id ' ]);
3334 $ client ->addServer ($ config ['host ' ], $ config ['port ' ]);
3435
35- return new MemcachedCachePool ($ client );
36+ $ pool = new MemcachedCachePool ($ client );
37+
38+ if (null !== $ config ['pool_namespace ' ]) {
39+ $ pool = new NamespacedCachePool ($ pool , $ config ['pool_namespace ' ]);
40+ }
41+
42+ return $ pool ;
3643 }
3744
3845 /**
@@ -41,13 +48,15 @@ public function getAdapter(array $config)
4148 protected static function configureOptionResolver (OptionsResolver $ resolver )
4249 {
4350 $ resolver ->setDefaults ([
44- 'persistent_id ' => null ,
45- 'host ' => '127.0.0.1 ' ,
46- 'port ' => 11211 ,
51+ 'persistent_id ' => null ,
52+ 'host ' => '127.0.0.1 ' ,
53+ 'port ' => 11211 ,
54+ 'pool_namespace ' => null ,
4755 ]);
4856
4957 $ resolver ->setAllowedTypes ('persistent_id ' , ['string ' , 'null ' ]);
5058 $ resolver ->setAllowedTypes ('host ' , ['string ' ]);
5159 $ resolver ->setAllowedTypes ('port ' , ['string ' , 'int ' ]);
60+ $ resolver ->setAllowedTypes ('pool_namespace ' , ['string ' , 'null ' ]);
5261 }
5362}
0 commit comments