Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 372d62e

Browse files
committed
Updated of DriverStatistic. After almost 8 years untouched 😁
1 parent 1e605b0 commit 372d62e

File tree

4 files changed

+57
-6
lines changed

4 files changed

+57
-6
lines changed

‎CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 9.2.3
2+
##### 11 january 2024
3+
- __Drivers__
4+
- **Added support of `Ravendb` as an extension with its own [sub-repository](https://github.com/PHPSocialNetwork/ravendb-extension).**
5+
- Deprecated `\Phpfastcache\Entities\DriverStatistic::getData()`. Will be removed as of v10.
6+
- Deprecated `\Phpfastcache\Entities\DriverStatistic::setData()`. Will be removed as of v10.
7+
- Added `\Phpfastcache\Entities\DriverStatistic::getCount(): int|null`. If applicable will return the count of cache objects stored in driver database/collection. Null otherwise.
8+
- Added `\Phpfastcache\Entities\DriverStatistic::setCount()`
9+
110
## 9.2.2
211
##### 11 january 2024
312
- __Core__
@@ -14,7 +23,7 @@
1423
- Upgraded Phpfastcache API to `4.3.0` ([see changes](CHANGELOG_API.md))
1524
- __Extensions__ (💡 New in 9.2)
1625
- Created an extension mechanism to allow some drivers to be loaded independently, see [README.md](README.md)
17-
- Created extension for `Couchbasev4` support to its own [sub-repository](https://github.com/PHPSocialNetwork/couchbasev4-extension).
26+
- Added support of `Couchbasev4` as an extension with its own [sub-repository](https://github.com/PHPSocialNetwork/couchbasev4-extension).
1827
- **IMPORTANT**: *AS OF v9.2* the following drivers has been **MOVED** to their own sub-repositories as a standalone extension: `Arangodb`, `Couchdb`, `Dynamodb`, `Firestore`, `Mongodb`, `Solr`. However `Couchbasev3` will stay in the core for compatibility reasons but will be deprecated.
1928
- **IMPORTANT**: *AS OF v10* extensions will have their namespaces permanently moved from `Phpfastcache\Drivers\EXT_NAME\{Config, Driver, Event, Item}` to `Phpfastcache\Extensions\Drivers\EXT_NAME\{Config, Driver, Event, Item}`. For now an alias is ensuring compatibility.
2029
- __Events__

‎composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"phpfastcache/dynamodb-extension": "^9.2",
6060
"phpfastcache/firestore-extension": "^9.2",
6161
"phpfastcache/mongodb-extension": "^9.2",
62+
"phpfastcache/ravendb-extension": "^9.2",
6263
"phpfastcache/solr-extension": "^9.2"
6364
},
6465
"autoload": {

‎lib/Phpfastcache/Entities/DriverStatistic.php

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@
1616

1717
namespace Phpfastcache\Entities;
1818

19+
/**
20+
* @see https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV5%CB%96%5D-The-cache-statistics
21+
*/
1922
class DriverStatistic
2023
{
2124
protected string $info = '';
2225

23-
protected int $size = 0;
26+
protected ?int $size = 0;
27+
28+
protected ?int $count = 0;
2429

2530
protected string $data = '';
2631

2732
protected mixed $rawData;
2833

34+
/**
35+
* Return quick information about the driver instance
36+
* @return string
37+
*/
2938
public function getInfo(): string
3039
{
3140
return $this->info;
@@ -38,30 +47,61 @@ public function setInfo(string $info): static
3847
return $this;
3948
}
4049

41-
public function getSize(): int
50+
/**
51+
* Return the approximate size taken by the driver instance (in bytes) (null if unsupported by the driver)
52+
* @return int|null
53+
*/
54+
public function getSize(): ?int
4255
{
4356
return $this->size;
4457
}
4558

46-
public function setSize(int $size): static
59+
public function setSize(?int $size): static
4760
{
4861
$this->size = $size;
4962

5063
return $this;
5164
}
5265

66+
/**
67+
* Return the approximate count of elements stored in a driver database (or collection if applicable). Added in v9.2.3
68+
* @since 9.2.3
69+
* @return int|null
70+
*/
71+
public function getCount(): ?int
72+
{
73+
return $this->count;
74+
}
75+
76+
public function setCount(?int $count): static
77+
{
78+
$this->count = $count;
79+
return $this;
80+
}
81+
82+
/**
83+
* Return an array of item keys used by this driver instance (deprecated as of v9.2.3, will be removed as of v10)
84+
* @deprecated as of phpfastcache 9.2.3, will be removed as of v10
85+
*/
5386
public function getData(): string
5487
{
5588
return $this->data;
5689
}
5790

91+
/**
92+
* @deprecated as of phpfastcache 9.2.3, will be removed as of v10
93+
*/
5894
public function setData(string $data): static
5995
{
6096
$this->data = ($data ?: '');
6197

6298
return $this;
6399
}
64100

101+
/**
102+
* Return a bunch of random data provided by the driver. Any type can be provided, usually an array
103+
* @return mixed
104+
*/
65105
public function getRawData(): mixed
66106
{
67107
return $this->rawData;
@@ -82,7 +122,8 @@ public function getPublicDesc(): array
82122
return [
83123
'Info' => 'Cache Information',
84124
'Size' => 'Cache Size',
85-
'Data' => 'Cache items keys',
125+
'Count' => 'Cache database/collection count',
126+
'Data' => 'Cache items keys (Deprecated)',
86127
'RawData' => 'Cache raw data',
87128
];
88129
}

‎lib/Phpfastcache/ExtensionManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Phpfastcache\Helper\UninstanciableObjectTrait;
2222

2323
/**
24-
* @internal This extension manager is meant to manager officials Phpfastcache's extensions.
24+
* @internal This extension manager is meant to manage officials Phpfastcache's extensions.
2525
* @see \Phpfastcache\CacheManager::addCustomDriver() to add you own drivers.
2626
*/
2727
final class ExtensionManager

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /