Skip to content

Commit d4a52b3

Browse files
committed
Renamed "Memstatic" to "Memory", updated composer metadata, improved EventManagerInterface::on() signature
1 parent 035b84a commit d4a52b3

33 files changed

+436
-181
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44
- Upgraded Phpfastcache API to `4.3.0` ([see changes](CHANGELOG_API.md))
55
- __Events__
66
- EventManager is now scoped to its own poll if retrieved through `ExtendedCacheItemPoolTrait::->getEventManager()`. Global EventManager `EventManager::getInstance()` remains unchanged, see [EVENTS.md](./docs/EVENTS.md).
7+
- `EventManagerInterface::on()` now accepts a single `string $events` or an `array $events`.
8+
- Alias `\Phpfastcache\PhpfastcacheEventManager` of `\Phpfastcache\EventManager` has been added to improve your code import readability.
79
- __Drivers__
810
- Implemented #906 // **Added `RedisCluster` driver support**
11+
- Driver `Memstatic` has changed its name to `Memory` for more consistency.
912
- __Pool__
1013
- Added `ExtendedCacheItemPoolTrait::getAllItems` to allow you to retrieve all items in the cache. This method have some limitations, ([see more in the Wiki](https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV5%CB%96%5D-Fetching-all-keys)).
1114
- __Core__
1215
- Configuration methods`ConfigurationOption::isPreventCacheSlams()`, `ConfigurationOption::setPreventCacheSlams()`, `ConfigurationOption::getCacheSlamsTimeout()`, `ConfigurationOption::setCacheSlamsTimeout()` are deprecated. ([See changes](CHANGELOG_API.md)).
1316
- Fixed #907 // Internal "driver decode()" method will now throw an if the string data looks corrupted.
1417
- Internal: Implemented multiple keys fetch (*if supported by the backend*) to improve the performances behind all `getItems()` calls. Currently only supported in some backends, but it may evolve in the future.
1518
- Internal: Implemented multiple keys delete (*if supported by the backend*) to improve the performances behind all `deleteItems()` calls. Currently only supported in some backends, but it may evolve in the future.
19+
- `\Phpfastcache\CacheContract::get()` now accepts a `\Stringable $cacheKey` argument.
1620
- __Misc__
1721
- Fixed multiple code typo & updated README.md
1822

CHANGELOG_API.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Created `IOConfigurationOption::setPreventCacheSlams()`. This method will **only be available** for `Files, Sqlite, Leveldb` drivers.
99
- Created `IOConfigurationOption::getCacheSlamsTimeout()`. This method will **only be available** for `Files, Sqlite, Leveldb` drivers.
1010
- Created `IOConfigurationOption::setCacheSlamsTimeout()`. This method will **only be available** for `Files, Sqlite, Leveldb` drivers.
11+
- Method `EventManagerInterface::on(array|string $events, callable $callback)` now accepts a single `string $events` or an `array $events`.
1112

1213

1314
## 4.2.0

SECURITY.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@ If you discover any vulnerability please be aware of the following table of supp
33
Then feel free to contact me at the email address provided in the bottom of that page.
44

55
## Supported Versions
6-
| Version | End of support | End of life |
7-
| ------- | -------------------- | ------------------ |
8-
| 9.x | December 2023 | December 2024 |
9-
| 8.x | July 2023 | July 2024 |
10-
| 7.1 | July 2021 | July 2022 |
11-
| 7.0 | July 2019 | July 2020 |
12-
| 6.0 | July 2020 | July 2021 |
13-
| 5.0 | July 2018 | July 2019 |
14-
| 4.0 | July 2017 | January 2018 |
15-
| < 4.0 | N/A | N/A |
6+
| Version | End of support | End of life |
7+
|---------|------------------|------------------|
8+
| 10.0 | *In development* | *In development* |
9+
| 9.2 | December 2025 | December 2026 |
10+
| 9.1 | December 2024 | December 2025 |
11+
| 9.0 | December 2023 | December 2024 |
12+
| 8.x | July 2023 | July 2024 |
13+
| 7.1 | July 2021 | July 2022 |
14+
| 7.0 | July 2019 | July 2020 |
15+
| 6.0 | July 2020 | July 2021 |
16+
| 5.0 | July 2018 | July 2019 |
17+
| 4.0 | July 2017 | January 2018 |
18+
| < 4.0 | N/A | N/A |
1619

1720
More details on the [Wiki](https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Global-support-timeline)
1821

1922
## Reporting a Vulnerability
2023
If you discover any security vulnerability contact me at contact#at#geolim4.com with a subject formatted like that:\
21-
`[PHPFASTCACHE][VULNERABILITY] Your subject goes here`
24+
`[PHPFASTCACHE][VULNERABILITY] Your mail subject goes here`
2225

2326
Thanks in advance for taking the time to report me that in private.

bin/ci/scripts/install_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ composer install
66
#####
77
# Travis CI have php mongodb extension locked to 1.10, so we must set the mongodb/mongodb minimum version to 1.9 :(
88
#####
9-
composer require -W doctrine/couchdb:dev-master phpfastcache/phpssdb:~1.1 predis/predis:~1.1 mongodb/mongodb:~1.9 triagens/arangodb:~3.8 aws/aws-sdk-php:~3.2 google/cloud-firestore:~1.39 solarium/solarium:~6.1
9+
composer require -W doctrine/couchdb:dev-master phpfastcache/phpssdb:~1.2 predis/predis:~1.1 mongodb/mongodb:~1.9 triagens/arangodb:~3.8 aws/aws-sdk-php:~3.2 google/cloud-firestore:~1.39 solarium/solarium:~6.1

composer.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
"keywords": ["abstract", "cache","caching","php cache","mysql cache","apc","apcu","arangodb","dynamodb","firestore","memcache","memcached","wincache","files cache","pdo cache","cache class","redis","redis cluster","predis","cookie", "mongodb", "cassandra", "couchdb", "couchbase", "LevelDb", "Solr", "Ssdb", "Wincache", "xcache","zend","zend disk cache","zend memory cache","zend data cache","zend server"],
66
"homepage": "https://www.phpfastcache.com",
77
"license": "MIT",
8+
"readme": "README.md",
89
"minimum-stability": "stable",
910
"authors": [
1011
{
1112
"name": "Georges.L",
1213
"email": "contact@geolim4.com",
1314
"homepage": "https://github.com/Geolim4",
14-
"role": "Actual Project Manager/Developer"
15+
"role": "Project Manager"
1516
},
1617
{
1718
"name": "Contributors",
@@ -23,7 +24,16 @@
2324
"psr/cache": "^2.0||^3.0",
2425
"psr/simple-cache": "^2.0||^3.0",
2526
"ext-mbstring": "*",
26-
"ext-json": "*"
27+
"ext-json": "*",
28+
"doctrine/couchdb": "dev-master",
29+
"phpfastcache/phpssdb": "~1.2",
30+
"predis/predis": "~1.1",
31+
"mongodb/mongodb": "~1.9",
32+
"triagens/arangodb": "~3.8",
33+
"aws/aws-sdk-php": "~3.2",
34+
"google/cloud-firestore": "~1.39",
35+
"solarium/solarium": "~6.1",
36+
"symfony/var-dumper": "^6.0"
2737
},
2838
"require-dev": {
2939
"league/climate": "^3.8",
@@ -35,9 +45,11 @@
3545
},
3646
"suggest": {
3747
"ext-apcu": "*",
48+
"ext-curl": "*",
3849
"ext-intl": "*",
3950
"ext-memcached": "*",
4051
"ext-cassandra": "*",
52+
"ext-grpc": "*",
4153
"ext-memcache": "*",
4254
"ext-mongodb": "*",
4355
"ext-redis": "*",
@@ -62,14 +74,20 @@
6274
},
6375
"autoload": {
6476
"psr-4": {
65-
"Phpfastcache\\": "lib/Phpfastcache/",
77+
"Phpfastcache\\": "lib/Phpfastcache/"
78+
}
79+
},
80+
"autoload-dev": {
81+
"psr-4": {
6682
"Phpfastcache\\Tests\\": "tests/lib/"
6783
}
6884
},
6985
"support": {
7086
"issues": "https://github.com/PHPSocialNetwork/phpfastcache/issues",
7187
"wiki": "https://github.com/PHPSocialNetwork/phpfastcache/wiki",
72-
"source": "https://github.com/PHPSocialNetwork/phpfastcache"
88+
"docs": "https://github.com/PHPSocialNetwork/phpfastcache/wiki",
89+
"source": "https://github.com/PHPSocialNetwork/phpfastcache",
90+
"security": "https://github.com/PHPSocialNetwork/phpfastcache/blob/master/SECURITY.md"
7391
},
7492
"funding": [
7593
{

docs/EVENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,16 @@ The order of execution of the events is always the following:
331331
- Allow you to alter the parameters built used to create the collection
332332
- **Risky Circular Methods**: None
333333

334+
#### Couchdb (v9.2)
335+
- onCouchdbCreateOptions(*Callable* **$callback**)
336+
- **Callback arguments**
337+
- *ExtendedCacheItemPoolInterface* **$itemPool**
338+
- *EventReferenceParameter($options)* **$options** _via EventReferenceParameter object_ **(type modification forbidden)**
339+
- **Scope**
340+
- Arangodb Driver
341+
- **Description**
342+
- Allow you to alter the options built used to create the Couchdb client instance.
343+
- **Risky Circular Methods**: None
334344
#### Dynamodb
335345
- onDynamodbCreateTable(*Callable* **$callback**)
336346
- **Callback arguments**

lib/Phpfastcache/CacheContract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public function __construct(CacheItemPoolInterface $cacheInstance)
3232
/**
3333
* @throws InvalidArgumentException
3434
*/
35-
public function get(string $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed
35+
public function get(string|\Stringable $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed
3636
{
37-
$cacheItem = $this->cacheInstance->getItem($cacheKey);
37+
$cacheItem = $this->cacheInstance->getItem((string) $cacheKey);
3838

3939
if (!$cacheItem->isHit()) {
4040
/*

lib/Phpfastcache/Core/Pool/ExtendedCacheItemPoolTrait.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,18 @@ public function getHelp(): string
118118
{
119119
return '';
120120
}
121+
122+
/**
123+
* @throws PhpfastcacheInvalidArgumentException
124+
*/
125+
public function throwUnsupportedDriverReadAllPattern(string $linkReference = ''): void
126+
{
127+
throw new PhpfastcacheInvalidArgumentException(
128+
sprintf(
129+
'%s does not support a pattern argument.%s',
130+
$this->getDriverName(),
131+
$linkReference ? " See $linkReference" : ''
132+
)
133+
);
134+
}
121135
}

lib/Phpfastcache/Drivers/Arangodb/Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*/
2626
class Config extends ConfigurationOption
2727
{
28-
protected string $database;
29-
protected string $collection;
28+
protected string $database = 'phpfastcache';
29+
protected string $collection = 'phpfastcache';
3030

3131
/**
3232
* @var string|array<string>

lib/Phpfastcache/Drivers/Arangodb/Driver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,16 @@ public function getStats(): DriverStatistic
292292
try {
293293
$adminHandler = new AdminHandler($this->instance);
294294
$rawData['adminInfo'] = $adminHandler->getServerVersion(true);
295+
295296
$infoText = \sprintf(
296-
'%s server v%s "%s" edition (%s/%s).',
297+
'%s server v%s "%s" edition (%s/%s). Database/Collection: "%s"/"%s"',
297298
\ucfirst($rawData['adminInfo']['server']),
298299
$rawData['adminInfo']['version'] ?? 'unknown version',
299300
$rawData['adminInfo']['license'] ?? 'unknown licence',
300301
$rawData['adminInfo']['details']['architecture'] ?? 'unknown architecture',
301302
$rawData['adminInfo']['details']['platform'] ?? 'unknown platform',
303+
$this->instance->getDatabase(),
304+
$rawData['collectionInfo']->getName(),
302305
);
303306
} catch (ArangoException $e) {
304307
$infoText = 'No readable human data, encountered an error while trying to get details: ' . $e->getMessage();

0 commit comments

Comments
 (0)