Skip to content

Commit bd30a47

Browse files
2.20
1 parent 8afdb58 commit bd30a47

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ or an entire group of elements.
88

99
[![Packagist](https://img.shields.io/packagist/v/eftec/CacheOne.svg)](https://packagist.org/packages/eftec/CacheOne)
1010
[![Total Downloads](https://poser.pugx.org/eftec/CacheOne/downloads)](https://packagist.org/packages/eftec/CacheOne)
11-
[![Maintenance](https://img.shields.io/maintenance/yes/2024.svg)]()
11+
[![Maintenance](https://img.shields.io/maintenance/yes/2025.svg)]()
1212
[![composer](https://img.shields.io/badge/composer-%3E1.6-blue.svg)]()
1313
[![php](https://img.shields.io/badge/php-7.4-green.svg)]()
1414
[![php](https://img.shields.io/badge/php-8.3-green.svg)]()
@@ -362,6 +362,8 @@ $cache=CacheOne::factory($cacheOneConfig);
362362

363363

364364
# Version
365+
* 2.20 (2024-12-30)
366+
* now compatible with php 8.4 without warnings.
365367
* 2.19 (2024-12-08)
366368
* [apcu] solved a problem with get() and the value is not found. It returned false instead of the default value.
367369
* 2.18 (2024-03-02)

lib/CacheOne.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
* Class CacheOne
2222
*
2323
* @package eftec
24-
* @version 2.19
24+
* @version 2.20
2525
* @link https://github.com/EFTEC/CacheOne
2626
* @author Jorge Patricio Castro Castillo <jcastro arroba eftec dot cl>
2727
* @license Dual License: Commercial and MIT
2828
*/
2929
class CacheOne
3030
{
31-
public const VERSION = "2.19";
31+
public const VERSION = "2.20";
3232
/** @var bool if true then it records every operation in $this::debugLog */
3333
public bool $debug = false;
3434
/** @var array If debug is true, then it records operations here. */
@@ -83,8 +83,8 @@ public function __construct(
8383
string $user = "",
8484
string $password = "",
8585
int $timeout = 8,
86-
int $retry = null,
87-
int $readTimeout = null
86+
?int $retry = null,
87+
?int $readTimeout = null
8888
)
8989
{
9090
$type = ($type === 'document') ? 'documentone' : $type;
@@ -173,7 +173,7 @@ public function __construct(
173173
* It creates a new instance of CacheOne using an array
174174
* @param array $array =['type','server','schema','port','user','password','timeout','retry','readTimeout'][$i]<br>
175175
* it could be an associative array or an indexed array.
176-
* @return void
176+
* @return CacheOne
177177
*/
178178
public static function factory(array $array): CacheOne
179179
{
@@ -322,7 +322,7 @@ public function genCatId($group): string
322322
* @return mixed
323323
* @throws JsonException
324324
*/
325-
public function unserialize($input, string $forcedSerializer = null)
325+
public function unserialize($input, ?string $forcedSerializer = null)
326326
{
327327
if ($input === false) {
328328
return false;
@@ -563,7 +563,7 @@ public function genId(string $key): string
563563
* @return bool
564564
* @throws Exception
565565
*/
566-
public function push($groups, string $key, $value, int $duration = null, int $limit = 0, string $limitStrategy = 'shiftold'): bool
566+
public function push($groups, string $key, $value, ?int $duration = null, int $limit = 0, string $limitStrategy = 'shiftold'): bool
567567
{
568568
return $this->executePushUnShift('push', $groups, $key, $value, $duration, $limit, $limitStrategy);
569569
}
@@ -648,7 +648,7 @@ protected function executePushUnShift(string $type, $groups, string $key, $value
648648
* @return bool
649649
* @throws Exception
650650
*/
651-
public function unshift($groups, string $key, $value, int $duration = null, int $limit = 0, string $limitStrategy = 'popold'): bool
651+
public function unshift($groups, string $key, $value, ?int $duration = null, int $limit = 0, string $limitStrategy = 'popold'): bool
652652
{
653653
return $this->executePushUnShift('unshift', $groups, $key, $value, $duration, $limit, $limitStrategy);
654654
}
@@ -676,7 +676,7 @@ public function unshift($groups, string $key, $value, int $duration = null, int
676676
* @throws Exception
677677
* @throws Exception
678678
*/
679-
public function pop($group, string $key, $defaultValue = PHP_INT_MAX, int $duration = null)
679+
public function pop($group, string $key, $defaultValue = PHP_INT_MAX, ?int $duration = null)
680680
{
681681
return $this->executePopShift('pop', $group, $key, $defaultValue, $duration);
682682
}
@@ -691,7 +691,7 @@ public function pop($group, string $key, $defaultValue = PHP_INT_MAX, int $durat
691691
* @throws Exception
692692
* @throws Exception
693693
*/
694-
protected function executePopShift(string $type, $group, string $key, $defaultValue = PHP_INT_MAX, int $duration = null)
694+
protected function executePopShift(string $type, $group, string $key, $defaultValue = PHP_INT_MAX, ?int $duration = null)
695695
{
696696
$defaultValue = $defaultValue === PHP_INT_MAX ? $this->defaultValue : $defaultValue;
697697
if (!$this->enabled) {
@@ -736,7 +736,7 @@ protected function executePopShift(string $type, $group, string $key, $defaultVa
736736
* @throws Exception
737737
* @throws Exception
738738
*/
739-
public function shift($group, string $key, $defaultValue = PHP_INT_MAX, int $duration = null)
739+
public function shift($group, string $key, $defaultValue = PHP_INT_MAX, ?int $duration = null)
740740
{
741741
return $this->executePopShift('shift', $group, $key, $defaultValue, $duration);
742742
}

0 commit comments

Comments
 (0)