File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of php-cache organization.
5+ *
6+ * (c) 2015-2015 Aaron Scherer <aequasi@gmail.com>, Tobias Nyholm <tobias.nyholm@gmail.com>
7+ *
8+ * This source file is subject to the MIT license that is bundled
9+ * with this source code in the file LICENSE.
10+ */
11+
12+ namespace Cache \AdapterBundle \Factory ;
13+
14+ use Cache \Namespaced \NamespacedCachePool ;
15+ use Symfony \Component \OptionsResolver \OptionsResolver ;
16+
17+ /**
18+ * @author Tobias Nyholm <tobias.nyholm@gmail.com>
19+ */
20+ class NamespacedFactory extends AbstractAdapterFactory
21+ {
22+ protected static $ dependencies = [
23+ ['requiredClass ' => 'Cache\Namespaced\NamespacedCachePool ' , 'packageName ' => 'cache/namespaced-cache ' ],
24+ ];
25+
26+ /**
27+ * {@inheritdoc}
28+ */
29+ public function getAdapter (array $ config )
30+ {
31+ return new NamespacedCachePool ($ config ['service ' ], $ config ['namespace ' ]);
32+ }
33+
34+ /**
35+ * {@inheritdoc}
36+ */
37+ protected static function configureOptionResolver (OptionsResolver $ resolver )
38+ {
39+ parent ::configureOptionResolver ($ resolver );
40+
41+ $ resolver ->setRequired (['namespace ' , 'service ' ]);
42+ $ resolver ->setAllowedTypes ('namespace ' , ['string ' ]);
43+ }
44+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ services:
1313 class : Cache\AdapterBundle\Factory\MemcachedFactory
1414 cache.factory.memcache :
1515 class : Cache\AdapterBundle\Factory\MemcacheFactory
16+ cache.factory.namespaced :
17+ class : Cache\AdapterBundle\Factory\NamespacedFactory
1618 cache.factory.predis :
1719 class : Cache\AdapterBundle\Factory\PredisFactory
1820 cache.factory.prefixed :
You can’t perform that action at this time.
0 commit comments