Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 1be43cf

Browse files
committed
Starting V2
1 parent dc082bf commit 1be43cf

File tree

6 files changed

+11
-30
lines changed

6 files changed

+11
-30
lines changed

DataCollector/CacheCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function collect(Request $request, Response $response, \Exception $except
6363
'write' => (int) CacheManager::$WriteHits,
6464
],
6565
'coreConfig' => [
66-
'namespacePath' => CacheManager::getNamespacePath()
66+
'namespacePath' => CacheManager::getNamespacePath()
6767
],
6868
];
6969
}

Docs/Example/app/config/phpfastcache-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ php_fast_cache:
4141
leveldbcache:
4242
type: Leveldb
4343
parameters:
44-
path: "%kernel.cache_dir%/phpfastcache_leveldb/"
44+
path: %kernel.cache_dir%/phpfastcache_leveldb/
4545
securityKey: optionnalSetting
4646
ssdbcache:
4747
type: Ssdb

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ php_fast_cache:
1717
filecache:
1818
type: Files
1919
parameters:
20-
path: "%kernel.cache_dir%/phpfastcache/"
20+
path: %kernel.cache_dir%/phpfastcache/
2121
```
2222
* More examples in Docs/Example/app/config
2323

Resources/config/services.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ services:
88
class: "%php_fast_cache.cache.class%"
99
arguments:
1010
- "%phpfastcache%"
11-
- "@?debug.stopwatch"
1211

1312
phpfastcache.request_collector:
1413
class: "%php_fast_cache.data_collector.class%"

Service/Cache.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,35 @@
22

33
namespace phpFastCache\Bundle\Service;
44

5-
use phpFastCache\Cache\ExtendedCacheItemPoolInterface;
5+
use phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface;
66
use phpFastCache\CacheManager;
77
use phpFastCache\Exceptions\phpFastCacheDriverException;
8-
use Symfony\Component\Stopwatch\Stopwatch;
98

109
/**
1110
* Class Cache
1211
* @package phpFastCache\Bundle\Service
1312
*/
1413
class 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
{

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
}
2828
],
2929
"require": {
30-
"symfony/symfony": "^2.8|3.*",
31-
"phpFastCache/phpFastCache": "^5.0"
30+
"symfony/symfony": "^3.0",
31+
"phpFastCache/phpFastCache": "^6.0"
3232
},
3333
"autoload": {
3434
"psr-4": { "phpFastCache\\Bundle\\": "" }

0 commit comments

Comments
 (0)