Skip to content

Commit 5376618

Browse files
committed
Removed clear() method as planned, replaced by clean() instead.
1 parent ab0bdad commit 5376618

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

MigratingFromV5ToV6.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,40 @@ try{
113113

114114
If you try to do so, an `\phpFastCache\Exceptions\phpFastCacheInvalidArgumentException` will be raised.
115115

116-
You must replace them with a safe delimiter such as `.|-_`
116+
You must replace them with a safe delimiter such as `.|-_`
117+
118+
### Cache clear method
119+
The deprecated method `phpFastCache\Cache\ExtendedCacheItemPoolInterface::clear()` is now definitely removed.
120+
121+
122+
#### :clock1: Then:
123+
In the V5 the method `phpFastCache\Cache\ExtendedCacheItemPoolInterface::clear()` was deprecated.
124+
125+
```php
126+
namespace My\Custom\Project;
127+
128+
129+
$instance = CacheManager::getInstance('Files');
130+
131+
if($instance instanceof \phpFastCache\Cache\ExtendedCacheItemPoolInterface)
132+
{
133+
$instance->clear();
134+
}
135+
136+
```
137+
138+
#### :alarm_clock: Now:
139+
In the V6 we removed it. Use `phpFastCache\Cache\ExtendedCacheItemPoolInterface::clean()` instead.
140+
141+
```php
142+
namespace My\Custom\Project;
143+
144+
145+
$instance = CacheManager::getInstance('Files');
146+
147+
if($instance instanceof \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface)
148+
{
149+
$instance->clean();
150+
}
151+
152+
```

src/phpFastCache/Core/Pool/ExtendedCacheItemPoolInterface.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,6 @@ public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512
119119
*/
120120
public function setItem(CacheItemInterface $item);
121121

122-
/**
123-
* Deletes all items in the pool.
124-
* @deprecated Use clear() instead
125-
* Will be removed in 5.1
126-
*
127-
* @return bool
128-
* True if the pool was successfully cleared. False if there was an error.
129-
*/
130-
public function clean();
131-
132122
/**
133123
* @return driverStatistic
134124
*/

src/phpFastCache/Core/Pool/ExtendedCacheItemPoolTrait.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ trait ExtendedCacheItemPoolTrait
2525
{
2626
use CacheItemPoolTrait;
2727

28-
/**
29-
* @inheritdoc
30-
*/
31-
public function clean()
32-
{
33-
trigger_error('Cache clean() method is deprecated, use clear() method instead', E_USER_DEPRECATED);
34-
return $this->clear();
35-
}
36-
3728
/**
3829
* @inheritdoc
3930
*/

src/phpFastCache/Helper/ActOnAll.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,6 @@ public function setItem(CacheItemInterface $item)
206206
return $callback(__FUNCTION__, func_get_args());
207207
}
208208

209-
/**
210-
* @return mixed
211-
*/
212-
public function clean()
213-
{
214-
$callback = $this->getGenericCallback();
215-
return $callback(__FUNCTION__, func_get_args());
216-
}
217-
218209
/**
219210
* @return mixed
220211
*/

0 commit comments

Comments
 (0)