22
33namespace phpFastCache \Bundle \Service ;
44
5- use phpFastCache \Cache \ExtendedCacheItemPoolInterface ;
5+ use phpFastCache \Core \ Pool \ExtendedCacheItemPoolInterface ;
66use phpFastCache \CacheManager ;
77use phpFastCache \Exceptions \phpFastCacheDriverException ;
8- use Symfony \Component \Stopwatch \Stopwatch ;
98
109/**
1110 * Class Cache
1211 * @package phpFastCache\Bundle\Service
1312 */
1413class Cache
1514{
16- /**
17- * @var array
18- */
1915 private $ drivers = [];
2016
21- /**
22- * @var Stopwatch
23- */
24- protected $ stopwatch ;
25-
2617 /**
2718 * Contains all cache instances
2819 *
29- * @var \phpFastCache\Cache \ExtendedCacheItemPoolInterface[]
20+ * @var \phpFastCache\Core\Pool \ExtendedCacheItemPoolInterface[]
3021 */
3122 private $ cacheInstances = [];
3223
3324 /**
3425 * Cache constructor.
3526 *
3627 * @param $drivers
37- * @param Stopwatch $stopwatch
3828 *
3929 * @throws \phpFastCache\Exceptions\phpFastCacheDriverException
4030 */
41- public function __construct ($ drivers, Stopwatch $ stopwatch = null )
31+ public function __construct ($ drivers )
4232 {
4333 $ this ->drivers = (array ) $ drivers [ 'drivers ' ];
44- $ this ->stopwatch = $ stopwatch ;
4534 }
4635
4736 /**
@@ -52,7 +41,7 @@ public function __construct($drivers, Stopwatch $stopwatch = null)
5241 *
5342 * @throws \phpFastCache\Exceptions\phpFastCacheDriverException
5443 */
55- public function createInstance ($ name , ExtendedCacheItemPoolInterface $ instance )
44+ public function createInstance ($ name , $ instance )
5645 {
5746 if (array_key_exists ($ name , $ this ->cacheInstances ) && $ this ->cacheInstances [ $ name ] instanceof ExtendedCacheItemPoolInterface) {
5847 throw new phpFastCacheDriverException ("Cache instance ' {$ name }' already exists " );
@@ -65,16 +54,12 @@ public function createInstance($name, ExtendedCacheItemPoolInterface $instance)
6554 *
6655 * @param string $name Name of configured driver
6756 *
68- * @return \phpFastCache\Cache \ExtendedCacheItemPoolInterface
57+ * @return \phpFastCache\Core\Pool \ExtendedCacheItemPoolInterface
6958 *
7059 * @throws \phpFastCache\Exceptions\phpFastCacheDriverException
7160 */
7261 public function get ($ name )
7362 {
74- if ($ this ->stopwatch ) {
75- $ this ->stopwatch ->start (__METHOD__ . "(' {$ name }') " );
76- }
77-
7863 if (!array_key_exists ($ name , $ this ->cacheInstances )) {
7964 if (array_key_exists ($ name , $ this ->drivers )) {
8065 $ this ->createInstance ($ name , CacheManager::getInstance ($ this ->drivers [ $ name ][ 'type ' ], $ this ->drivers [ $ name ][ 'parameters ' ]));
@@ -86,16 +71,13 @@ public function get($name)
8671 }
8772 }
8873
89- if ($ this ->stopwatch ) {
90- $ this ->stopwatch ->stop (__METHOD__ . "(' {$ name }') " );
91- }
9274 return $ this ->cacheInstances [ $ name ];
9375 }
9476
9577 /**
9678 * Return all cache instances
9779 *
98- * @return \phpFastCache\Cache \ExtendedCacheItemPoolInterface[]
80+ * @return \phpFastCache\Core\Pool \ExtendedCacheItemPoolInterface[]
9981 */
10082 public function getInstances ()
10183 {
0 commit comments