Skip to content

Commit 8afdb58

Browse files
2.19
1 parent 806f213 commit 8afdb58

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ $cache=CacheOne::factory($cacheOneConfig);
362362

363363

364364
# Version
365+
* 2.19 (2024-12-08)
366+
* [apcu] solved a problem with get() and the value is not found. It returned false instead of the default value.
365367
* 2.18 (2024-03-02)
366368
* Updating dependency to PHP 7.4. The extended support of PHP 7.2 ended 3 years ago.
367369
* Added more type hinting in the code.

lib/CacheOne.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
* Class CacheOne
2222
*
2323
* @package eftec
24-
* @version 2.18
24+
* @version 2.19
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.18";
31+
public const VERSION = "2.19";
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. */

lib/provider/CacheOneProviderAPCU.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function get(string $key, $defaultValue = false)
7272
{
7373
$uid = $this->parent->genId($key);
7474
$r = $this->parent->unserialize(apcu_fetch($uid));
75-
return $r ?? $defaultValue;
75+
return $r===false ? $defaultValue : $r;
7676
}
7777

7878
public function set(string $uid, array $groups, string $key, $value, int $duration = 1440) : bool

test/CacheOneTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private function runMe($type, $schema, $serializer='php', $server='127.0.0.1'):
156156
self::assertStringContainsString($type,$class);
157157
}
158158

159-
159+
$this->assertEquals('abc',$cache->get('group1','keynotexist','abc'));
160160
// wrapper test
161161
self::assertTrue($cache->setCache("key1", "family", "hello world"));
162162
self::assertEquals("hello world",$cache->getCache("key1","family"));
@@ -319,6 +319,7 @@ public function test_apcu(): void
319319
ini_set("apc.use_request_time", 0);
320320
$type='apcu';
321321
$this->runMe($type,'unittest');
322+
322323
$this->runDuration($type,'unittest');
323324
}
324325
public function test_pdoone(): void

0 commit comments

Comments
 (0)