File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 1212namespace Cache \AdapterBundle \Factory ;
1313
1414use Cache \Adapter \PHPArray \ArrayCachePool ;
15+ use Cache \Namespaced \NamespacedCachePool ;
16+ use Symfony \Component \OptionsResolver \OptionsResolver ;
1517
1618/**
1719 * @author Tobias Nyholm <[email protected] > @@ -27,6 +29,28 @@ class ArrayFactory extends AbstractAdapterFactory
2729 */
2830 public function getAdapter (array $ config )
2931 {
30- return new ArrayCachePool ();
32+ $ pool = new ArrayCachePool ();
33+
34+ if (null !== $ config ['pool_namespace ' ]) {
35+ $ pool = new NamespacedCachePool ($ pool , $ config ['pool_namespace ' ]);
36+ }
37+
38+ return $ pool ;
39+ }
40+
41+ /**
42+ * {@inheritdoc}
43+ */
44+ protected static function configureOptionResolver (OptionsResolver $ resolver )
45+ {
46+ parent ::configureOptionResolver ($ resolver );
47+
48+ $ resolver ->setDefaults (
49+ [
50+ 'pool_namespace ' => null ,
51+ ]
52+ );
53+
54+ $ resolver ->setAllowedTypes ('pool_namespace ' , ['string ' , 'null ' ]);
3155 }
3256}
You can’t perform that action at this time.
0 commit comments