Skip to content

Commit c594c36

Browse files
committed
Released final 9.1.0 changes
1 parent a2f3283 commit c594c36

19 files changed

+157
-36
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
- __API__
44
- Upgraded Phpfastcache API to `4.1.0` ([see changes](CHANGELOG_API.md))
55
- __Core__
6+
- Added `\Phpfastcache\Helper\UninstanciableObjectTrait` trait which will contains base locked constructor for any classes that are nor meant to be instanciated.
67
- Deprecated `\Phpfastcache\Config\Config::class`
78
- Removed/reworked/improved dead/unreachable/redundant/obsolete code, thanks to `Phpstan`
89
- __Drivers__
910
- **Added `Solr` driver support**
11+
- __Events__
12+
- Added `\Phpfastcache\Event\EventInterface` for `\Phpfastcache\Event\Event` and subclasses below
13+
- Added `\Phpfastcache\Drivers\Arangodb\Event` for Arangodb events
14+
- Added `\Phpfastcache\Drivers\Dynamodb\Event` for Dynamodb events
15+
- Added `\Phpfastcache\Drivers\Solr\Event` for Solr events
16+
- Moved the following constant from `\Phpfastcache\Event\Event` to their respective drivers: `ARANGODB_CONNECTION`, `ARANGODB_COLLECTION_PARAMS`, `DYNAMODB_CREATE_TABLE`
1017
- __Cluster__
1118
- Fixed #855 // ClusterReplication drivers are saving erroneous expiration date in low-level backends
1219
- __Misc__

CHANGELOG_API.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 4.1.0
2+
- Created `\Phpfastcache\Event\EventInterface` which will be used for `Phpfastcache\Event\Event` and any `Phpfastcache\Drivers\xxxxxxx\Event` classes
23
- Extended `CacheItemPoolInterface::save()` with `ExtendedCacheItemPoolInterface::save()` for re-typing
34
- Method `ExtendedCacheItemPoolInterface::getConfig()` now returns `ConfigurationOptionInterface` instead of `ConfigurationOption`
45
- Method `ExtendedCacheItemPoolInterface::getDefaultConfig()` now returns `ConfigurationOptionInterface` instead of `ConfigurationOption`

docs/EVENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,14 @@ This is an exhaustive list, and it will be updated as soon as new events will be
276276
- **Description**
277277
- Allow you to alter the parameters built used to create the table
278278
- **Risky Circular Methods**: None
279+
280+
#### Solr
281+
- onSolrBuildEndpoint(*Callable* **$callback**)
282+
- **Callback arguments**
283+
- *ExtendedCacheItemPoolInterface* **$itemPool**
284+
- *EventReferenceParameter($params)* **$endpoints** _via EventReferenceParameter object_ **(type modification forbidden)**
285+
- **Scope**
286+
- Solr Driver
287+
- **Description**
288+
- Allow you to alter the endpoints built used to connect to Solr server
289+
- **Risky Circular Methods**: None

lib/Phpfastcache/Api.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,17 @@
1818

1919
use Phpfastcache\Exceptions\PhpfastcacheIOException;
2020
use Phpfastcache\Exceptions\PhpfastcacheLogicException;
21+
use Phpfastcache\Helper\UninstanciableObjectTrait;
2122

2223
/**
2324
* Class Api
2425
* @package Phpfastcache
2526
*/
2627
class Api
2728
{
28-
protected static string $version = '4.1.0';
29+
use UninstanciableObjectTrait;
2930

30-
/**
31-
* Api constructor.
32-
*/
33-
final protected function __construct()
34-
{
35-
// The Api is not meant to be instantiated
36-
}
31+
protected static string $version = '4.1.0';
3732

3833
/**
3934
* This method will return the current

lib/Phpfastcache/CacheManager.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException;
2727
use Phpfastcache\Exceptions\PhpfastcacheLogicException;
2828
use Phpfastcache\Exceptions\PhpfastcacheUnsupportedOperationException;
29+
use Phpfastcache\Helper\UninstanciableObjectTrait;
2930
use Phpfastcache\Util\ClassNamespaceResolverTrait;
3031

3132
/**
@@ -34,6 +35,7 @@
3435
class CacheManager
3536
{
3637
use ClassNamespaceResolverTrait;
38+
use UninstanciableObjectTrait;
3739

3840
public const CORE_DRIVER_NAMESPACE = 'Phpfastcache\Drivers\\';
3941

@@ -56,14 +58,6 @@ class CacheManager
5658
*/
5759
protected static array $driverCustoms = [];
5860

59-
/**
60-
* CacheManager constructor.
61-
*/
62-
final protected function __construct()
63-
{
64-
// The cache manager is not meant to be instantiated
65-
}
66-
6761
/**
6862
* @param string $instanceId
6963
* @return ExtendedCacheItemPoolInterface
@@ -270,7 +264,7 @@ static function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInsta
270264
*/
271265
public static function setDefaultConfig(ConfigurationOptionInterface $config): void
272266
{
273-
if (is_subclass_of($config, ConfigurationOption::class)) {
267+
if (\is_subclass_of($config, ConfigurationOption::class)) {
274268
throw new PhpfastcacheInvalidArgumentException('Default configuration cannot be a child class of ConfigurationOption::class');
275269
}
276270
self::$config = $config;

lib/Phpfastcache/Config/IOConfigurationOptionTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ public function setCacheFileExtension(string $cacheFileExtension): static
9090
$this->enforceLockedProperty(__FUNCTION__);
9191
$safeFileExtensions = \explode('|', IOConfigurationOptionInterface::SAFE_FILE_EXTENSIONS);
9292

93-
if (str_contains($cacheFileExtension, '.')) {
93+
if (\str_contains($cacheFileExtension, '.')) {
9494
throw new PhpfastcacheInvalidConfigurationException('cacheFileExtension cannot contain a dot "."');
9595
}
9696
if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) {
9797
throw new PhpfastcacheInvalidConfigurationException(
98-
"Extension \"$cacheFileExtension\" is not safe, currently allowed extension names: " . \implode(', ', $safeFileExtensions)
98+
"Extension \"$cacheFileExtension\" is unsafe, currently allowed extension names: " . \implode(', ', $safeFileExtensions)
9999
);
100100
}
101101

lib/Phpfastcache/Drivers/Arangodb/Driver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
3131
use Phpfastcache\Core\Pool\TaggableCacheItemPoolTrait;
3232
use Phpfastcache\Entities\DriverStatistic;
33-
use Phpfastcache\Event\Event;
3433
use Phpfastcache\Event\EventReferenceParameter;
3534
use Phpfastcache\Exceptions\PhpfastcacheDriverConnectException;
3635
use Phpfastcache\Exceptions\PhpfastcacheDriverException;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Phpfastcache\Drivers\Arangodb;
4+
5+
class Event extends \Phpfastcache\Event\Event
6+
{
7+
public const ARANGODB_CONNECTION = 'ArangodbConnection';
8+
public const ARANGODB_COLLECTION_PARAMS = 'ArangodbCollectionParams';
9+
}

lib/Phpfastcache/Drivers/Dynamodb/Driver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
2626
use Phpfastcache\Core\Pool\TaggableCacheItemPoolTrait;
2727
use Phpfastcache\Entities\DriverStatistic;
28-
use Phpfastcache\Event\Event;
2928
use Phpfastcache\Event\EventReferenceParameter;
3029
use Phpfastcache\Exceptions\PhpfastcacheDriverConnectException;
3130
use Phpfastcache\Exceptions\PhpfastcacheDriverException;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Phpfastcache\Drivers\Dynamodb;
4+
5+
class Event extends \Phpfastcache\Event\Event
6+
{
7+
public const DYNAMODB_CREATE_TABLE = 'DynamodbCreateTable';
8+
}

0 commit comments

Comments
 (0)