You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+6-2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
## 9.0.0
2
-
##### 1 november 2021
2
+
##### 1 october 2021
3
3
-__Migration guide__
4
4
- Read the [migration guide](./docs/migration/MigratingFromV8ToV9.md) to upgrade from V8 to V9
5
5
-__API__
@@ -9,6 +9,8 @@
9
9
- Renamed `Api::getPhpFastCacheGitHeadHash()` to `Api::getPhpfastcacheGitHeadHash()`
10
10
-__Cluster__
11
11
- Renamed `\Phpfastcache\Cluster\AggregatorInterface::aggregateNewDriver()` to `\Phpfastcache\Cluster\AggregatorInterface::aggregateDriverByName()`
12
+
-__Exceptions__
13
+
- Added `PhpfastcacheEventManagerException` for EventManager-related exceptions
12
14
-__Global__
13
15
- Removed magics methods from CacheManager `CacheManager::DriverName()`, use `CacheManager::getInstance('DriverName')` instead
14
16
- Slightly increased performances on some critical points of the library
@@ -45,7 +47,9 @@
45
47
- Added `Devrandom` with configurable factor chance and data length
46
48
- Renamed classes `\Phpfastcache\Cluster\Drivers\[STATEGY]\[CLUSTER_NAME]Cluster` to `\Phpfastcache\Cluster\Drivers\[STATEGY]\Driver` for better driver naming across the project
47
49
-__Events__
48
-
- Added `\Phpfastcache\Event\EventReferenceParameter` class, see [EVENTS.md](./docs/EVENTS.md) file for more information
50
+
- Added `\Phpfastcache\Event\EventReferenceParameter` class and more events such as driver-specific events, see [EVENTS.md](./docs/EVENTS.md) file for more information
51
+
- Event callbacks will now receive the `eventName` as an extra _last_ callback parameter (except for `onEveryEvents` callbacks)
52
+
- Added `EventManagerInterface::on(array $eventNames, $callback)` method, to subscribe to multiple events in once with the same callback
49
53
- Added method named `unbindAllEventCallbacks(): bool` to `EventManagerInterface` to allow you to unbind/clear all event from an event instance
50
54
- Updated argument type #2 (`$items`) of `onCacheSaveMultipleItems()` event from `ExtendedCacheItemInterface[]` to `EventReferenceParameter($items)`
51
55
- Updated argument type #2 (`$items`) of `onCacheCommitItem()` event from `ExtendedCacheItemInterface[]` to `EventReferenceParameter($items)`
:new: In V9 some callback parameter, that aren't objects, are passed by reference via the new `\Phpfastcache\Event\EventReferenceParameter` class.\
38
-
This class is instantiated and passed to the callback with the original value passed **by reference** allowing you to either read or re-write its value.\
39
-
If it's allowed by the event dispatcher the type can be changed or not.\
40
-
If you try to while it's not allowed, you will get a `PhpfastcacheInvalidArgumentException` when trying to call `\Phpfastcache\Event\EventReferenceParameter::setParameterValue()`\
41
-
Finally the class `\Phpfastcache\Event\EventReferenceParameter` is `invokable` and trying to do so will return you the parameter value.\
37
+
:new: in V8
42
38
43
-
:new: In V9, a method named `unbindAllEventCallbacks(): bool` has been added to `EventManagerInterface` to allow you to unbind/clear all event from an event instance.
39
+
You can simply subscribe to **every** events at once of Phpfastcache.
40
+
```php
41
+
<?php
42
+
use Phpfastcache\EventManager;
43
+
44
+
EventManager::getInstance()->onEveryEvents(static function (string $eventName, ...$args) {
45
+
echo sprintf("Triggered event '{$eventName}' with %d arguments provided", count($args));
46
+
}, 'debugCallback');
47
+
```
48
+
49
+
This is an exhaustive list, and it will be updated as soon as new events will be added to the Core.
50
+
51
+
52
+
:new: In V9
53
+
54
+
- Some callback parameter, that are __NOT__ objects, are passed by reference via the new `\Phpfastcache\Event\EventReferenceParameter` class.\
55
+
This class is instantiated and passed to the callback with the original value passed **by reference** allowing you to either read or re-write its value.\
56
+
If it's allowed by the event dispatcher the type can be changed or not.\
57
+
If you try to while it's not allowed, you will get a `PhpfastcacheInvalidArgumentException` when trying to call `\Phpfastcache\Event\EventReferenceParameter::setParameterValue()`\
58
+
Finally the class `\Phpfastcache\Event\EventReferenceParameter` is `invokable` and trying to do so will return you the parameter value.\
59
+
- A method named `unbindAllEventCallbacks(): bool` has been added to `EventManagerInterface` to allow you to unbind/clear all event from an event instance.
60
+
- Event callbacks will now receive the `eventName` as an extra _last_ callback parameter (except for `onEveryEvents` callbacks)
61
+
- Added `EventManagerInterface::on(array $eventNames, $callback)` method, to subscribe to multiple events in once with the same callback
44
62
45
63
## List of active events:
46
64
### ItemPool Events
@@ -226,14 +244,35 @@ Finally the class `\Phpfastcache\Event\EventReferenceParameter` is `invokable` a
226
244
-**Risky Circular Methods**
227
245
-*ExtendedCacheItemInterface::expiresAt()*
228
246
229
-
:new: As of the **V8** you can simply subscribe to **every** events at once of Phpfastcache.
0 commit comments