Skip to content

Commit 32130cf

Browse files
committed
Started 9.2 (WIP):
- __API__ - Upgraded Phpfastcache API to `4.3.0` ([see changes](CHANGELOG_API.md)) - __Drivers__ - Implemented #906 // **Added `RedisCluster` driver support** - __Pool__ - 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)). - __Core__ - Configuration methods`ConfigurationOption::isPreventCacheSlams()`, `ConfigurationOption::setPreventCacheSlams()`, `ConfigurationOption::getCacheSlamsTimeout()`, `ConfigurationOption::setCacheSlamsTimeout()` are deprecated. ([See changes](CHANGELOG_API.md)). - Fixed #907 // Internal "driver decode()" method will now throw an if the string data looks corrupted. - 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. - __Misc__ - Fixed multiple code typo & updated README.md
1 parent c82647a commit 32130cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1430
-266
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 9.2.0
2+
##### xx january 2024
3+
- __API__
4+
- Upgraded Phpfastcache API to `4.3.0` ([see changes](CHANGELOG_API.md))
5+
- __Drivers__
6+
- Implemented #906 // **Added `RedisCluster` driver support**
7+
- __Pool__
8+
- 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)).
9+
- __Core__
10+
- Configuration methods`ConfigurationOption::isPreventCacheSlams()`, `ConfigurationOption::setPreventCacheSlams()`, `ConfigurationOption::getCacheSlamsTimeout()`, `ConfigurationOption::setCacheSlamsTimeout()` are deprecated. ([See changes](CHANGELOG_API.md)).
11+
- Fixed #907 // Internal "driver decode()" method will now throw an if the string data looks corrupted.
12+
- 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.
13+
- __Misc__
14+
- Fixed multiple code typo & updated README.md
15+
116
## 9.1.3
217
##### 12 february 2023
318
- __Core__

CHANGELOG_API.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 4.3.0
2+
- Created method `ExtendedCacheItemPoolTrait::getAllItems(string $pattern = ''): iterable` which will return all the items stored 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)).
3+
- Deprecated `ConfigurationOption::isPreventCacheSlams()` for future removal, use `IOConfigurationOption::isPreventCacheSlams()` instead.
4+
- Deprecated `ConfigurationOption::setPreventCacheSlams()` for future removal, use `IOConfigurationOption::setPreventCacheSlams()` instead.
5+
- Deprecated `ConfigurationOption::getCacheSlamsTimeout()` for future removal, use `IOConfigurationOption::getCacheSlamsTimeout()` instead.
6+
- Deprecated `ConfigurationOption::setCacheSlamsTimeout()` for future removal, use `IOConfigurationOption::setCacheSlamsTimeout()` instead.
7+
- Created `IOConfigurationOption::isPreventCacheSlams()`. This method will **only be available** for `Files, Sqlite, Leveldb` drivers.
8+
- Created `IOConfigurationOption::setPreventCacheSlams()`. This method will **only be available** for `Files, Sqlite, Leveldb` drivers.
9+
- Created `IOConfigurationOption::getCacheSlamsTimeout()`. This method will **only be available** for `Files, Sqlite, Leveldb` drivers.
10+
- Created `IOConfigurationOption::setCacheSlamsTimeout()`. This method will **only be available** for `Files, Sqlite, Leveldb` drivers.
11+
12+
113
## 4.2.0
214
- Created method `\Phpfastcache\Cluster\AggregatablePoolInterface::isAggregatedBy(): ?ClusterPoolInterface` which will return the aggregator object for Cluster aggregators
315
- Created method `\Phpfastcache\Cluster\AggregatablePoolInterface::setAggregatedBy(ClusterPoolInterface $clusterPool): static` which will allow to set the aggregator object

README.md

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

docs/DRIVERS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141
* A very high-performance NoSQL driver using a key-value pair system.
4242
* Predis
4343
* A high-performance memory driver using a in-memory data structure storage. Less efficient than Redis driver as it is an embedded library.
44-
* Redis
44+
* Redis/RedisCluster
4545
* A very high-performance memory driver using a in-memory data structure storage. More efficient than Predis driver as it is an compiled library.
46+
* RedisCluster use the RedisCluster class with a different driver name but behave slightly differently than Redis driver.
4647
* Riak **(REMOVED in v8.0.6)**
4748
* A very high-performance NoSQL driver using a key-value pair system.
4849
* Solr **(Added in V9.1)**

docs/EVENTS.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,19 @@ This is an exhaustive list, and it will be updated as soon as new events will be
7575
- *ExtendedCacheItemPoolInterface::getItems()*
7676
- *ExtendedCacheItemPoolInterface::getItemsByTag()*
7777
- *ExtendedCacheItemPoolInterface::getItemsAsJsonString()*
78-
78+
- onCacheGetItems(*Callable* **$callback**)
79+
- **Callback arguments**
80+
- *ExtendedCacheItemPoolInterface* **$itemPool**
81+
- *ExtendedCacheItemInterface[]* **$items**
82+
- **Scope**
83+
- ItemPool
84+
- **Description**
85+
- Allow you to manipulate a set of items just before it gets returned by the getItems() method.
86+
- **Risky Circular Methods**
87+
- *ExtendedCacheItemPoolInterface::getItem()*
88+
- *ExtendedCacheItemPoolInterface::getItems()*
89+
- *ExtendedCacheItemPoolInterface::getItemsByTag()*
90+
- *ExtendedCacheItemPoolInterface::getItemsAsJsonString()*
7991
- onCacheDeleteItem(*Callable* **$callback**)
8092
- **Callback arguments**
8193
- *ExtendedCacheItemPoolInterface* **$itemPool**

lib/Phpfastcache/Api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Api
2828
{
2929
use UninstanciableObjectTrait;
3030

31-
protected static string $version = '4.2.0';
31+
protected static string $version = '4.3.0';
3232

3333
/**
3434
* This method will return the current

lib/Phpfastcache/Config/ConfigurationOption.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ public function setPath(string $path): static
232232
}
233233

234234
/**
235+
* @deprecated This method is deprecated and will be soon moved to IOConfigurationOption class, which means they will only be available for `IO` drivers.
235236
* @return bool
236237
*/
237238
public function isPreventCacheSlams(): bool
@@ -240,18 +241,27 @@ public function isPreventCacheSlams(): bool
240241
}
241242

242243
/**
244+
* @deprecated This method is deprecated and will be soon moved to IOConfigurationOption class, which means they will only be available for `IO` drivers.
243245
* @param bool $preventCacheSlams
244246
* @return ConfigurationOption
245247
* @throws PhpfastcacheLogicException
246248
*/
247249
public function setPreventCacheSlams(bool $preventCacheSlams): static
248250
{
251+
if ($preventCacheSlams !== $this->preventCacheSlams) {
252+
trigger_error(
253+
'This method is deprecated and will be soon moved to IOConfigurationOption class, which means they will only be available for `IO` drivers.',
254+
E_USER_DEPRECATED
255+
);
256+
}
257+
249258
$this->enforceLockedProperty(__FUNCTION__);
250259
$this->preventCacheSlams = $preventCacheSlams;
251260
return $this;
252261
}
253262

254263
/**
264+
* @deprecated This method is deprecated and will be soon moved to IOConfigurationOption class, which means they will only be available for `IO` drivers.
255265
* @return int
256266
*/
257267
public function getCacheSlamsTimeout(): int
@@ -260,12 +270,19 @@ public function getCacheSlamsTimeout(): int
260270
}
261271

262272
/**
273+
* @deprecated This method is deprecated and will be soon moved to IOConfigurationOption class, which means they will only be available for `IO` drivers.
263274
* @param int $cacheSlamsTimeout
264275
* @return ConfigurationOption
265276
* @throws PhpfastcacheLogicException
266277
*/
267278
public function setCacheSlamsTimeout(int $cacheSlamsTimeout): static
268279
{
280+
if ($cacheSlamsTimeout !== $this->cacheSlamsTimeout) {
281+
trigger_error(
282+
'This method is deprecated and will be soon moved to IOConfigurationOption class, which means they will only be available for `IO` drivers.',
283+
E_USER_DEPRECATED
284+
);
285+
}
269286
$this->enforceLockedProperty(__FUNCTION__);
270287
$this->cacheSlamsTimeout = $cacheSlamsTimeout;
271288
return $this;

lib/Phpfastcache/Config/ConfigurationOptionInterface.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,6 @@ public function getPath(): string;
106106
*/
107107
public function setPath(string $path): static;
108108

109-
/**
110-
* @return bool
111-
*/
112-
public function isPreventCacheSlams(): bool;
113-
114-
/**
115-
* @param bool $preventCacheSlams
116-
* @return ConfigurationOption
117-
*/
118-
public function setPreventCacheSlams(bool $preventCacheSlams): static;
119-
120-
/**
121-
* @return int
122-
*/
123-
public function getCacheSlamsTimeout(): int;
124-
125-
/**
126-
* @param int $cacheSlamsTimeout
127-
* @return ConfigurationOption
128-
*/
129-
public function setCacheSlamsTimeout(int $cacheSlamsTimeout): static;
130109
/**
131110
* @return bool
132111
*/

lib/Phpfastcache/Config/IOConfigurationOption.php

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use Phpfastcache\Exceptions\PhpfastcacheInvalidConfigurationException;
2020
use Phpfastcache\Exceptions\PhpfastcacheLogicException;
2121

22+
/**
23+
* @todo: As of V10, imports cache slams properties.
24+
*/
2225
class IOConfigurationOption extends ConfigurationOption
2326
{
2427
protected bool $secureFileManipulation = false;
@@ -60,7 +63,7 @@ public function isSecureFileManipulation(): bool
6063

6164
/**
6265
* @param bool $secureFileManipulation
63-
* @return self
66+
* @return static
6467
* @throws PhpfastcacheLogicException
6568
*/
6669
public function setSecureFileManipulation(bool $secureFileManipulation): static
@@ -113,7 +116,7 @@ public function getDefaultChmod(): int
113116

114117
/**
115118
* @param int $defaultChmod
116-
* @return self
119+
* @return static
117120
* @throws PhpfastcacheLogicException
118121
*/
119122
public function setDefaultChmod(int $defaultChmod): static
@@ -122,4 +125,45 @@ public function setDefaultChmod(int $defaultChmod): static
122125
$this->defaultChmod = $defaultChmod;
123126
return $this;
124127
}
128+
129+
130+
/**
131+
* @return bool
132+
*/
133+
public function isPreventCacheSlams(): bool
134+
{
135+
return $this->preventCacheSlams;
136+
}
137+
138+
/**
139+
* @param bool $preventCacheSlams
140+
* @return static
141+
* @throws PhpfastcacheLogicException
142+
*/
143+
public function setPreventCacheSlams(bool $preventCacheSlams): static
144+
{
145+
$this->enforceLockedProperty(__FUNCTION__);
146+
$this->preventCacheSlams = $preventCacheSlams;
147+
return $this;
148+
}
149+
150+
/**
151+
* @return int
152+
*/
153+
public function getCacheSlamsTimeout(): int
154+
{
155+
return $this->cacheSlamsTimeout;
156+
}
157+
158+
/**
159+
* @param int $cacheSlamsTimeout
160+
* @return static
161+
* @throws PhpfastcacheLogicException
162+
*/
163+
public function setCacheSlamsTimeout(int $cacheSlamsTimeout): static
164+
{
165+
$this->enforceLockedProperty(__FUNCTION__);
166+
$this->cacheSlamsTimeout = $cacheSlamsTimeout;
167+
return $this;
168+
}
125169
}

lib/Phpfastcache/Config/IOConfigurationOptionInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,12 @@ public function setCacheFileExtension(string $cacheFileExtension): static;
3939
public function getDefaultChmod(): int;
4040

4141
public function setDefaultChmod(int $defaultChmod): static;
42+
43+
public function isPreventCacheSlams(): bool;
44+
45+
public function setPreventCacheSlams(bool $preventCacheSlams): static;
46+
47+
public function getCacheSlamsTimeout(): int;
48+
49+
public function setCacheSlamsTimeout(int $cacheSlamsTimeout): static;
4250
}

0 commit comments

Comments
 (0)