Skip to content

Commit 3d89ffb

Browse files
committed
Fixed #460
1 parent 2478ab0 commit 3d89ffb

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

docs/migration/MigratingFromV5ToV6.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,37 @@ Notice: Undefined index: e in /phpfastcache/src/phpFastCache/Core/Pool/DriverBas
88
Fatal error: Uncaught phpFastCache\Exceptions\phpFastCacheInvalidArgumentException: $expiration must be an object implementing the DateTimeInterface in ...
99
```
1010

11+
### Setting up a default config
12+
13+
#### :clock1: Then:
14+
PhpFastCache used to set a default global config using the `CacheManager::setup()` method
15+
16+
```php
17+
namespace My\Custom\Project;
18+
19+
20+
$instance = CacheManager::setup([
21+
'path' => 'somewhere'
22+
]);
23+
$instance = CacheManager::getInstance('Files');
24+
25+
```
26+
27+
#### :alarm_clock: Now:
28+
This method has been changed is now replaced by the `CacheManager::setDefaultConfig()` method.
29+
Using the old `CacheManager::setup()` method will trigger a `phpFastCacheInvalidConfigurationException`
30+
31+
```php
32+
namespace My\Custom\Project;
33+
34+
35+
$instance = CacheManager::setDefaultConfig([
36+
'path' => 'somewhere'
37+
]);
38+
$instance = CacheManager::getInstance('Files');
39+
40+
```
41+
1142
### Type hint of Driver instances
1243

1344
#### :clock1: Then:

src/phpFastCache/CacheManager.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,18 @@ public static function setDefaultConfig($name, $value = null)
332332
}
333333
}
334334

335+
/**
336+
* @param $name string|array
337+
* @param mixed $value
338+
* @throws phpFastCacheInvalidConfigurationException
339+
* @deprecated Method "setup" is deprecated, please use "setDefaultConfig" method instead
340+
*/
341+
public static function setup($name, $value = null)
342+
{
343+
throw new phpFastCacheInvalidConfigurationException(sprintf('Method "%s" is deprecated, please use "setDefaultConfig" method instead.', __FUNCTION__));
344+
}
345+
346+
335347
/**
336348
* @return array
337349
*/

0 commit comments

Comments
 (0)