Skip to content

Commit 740154d

Browse files
committed
fix: address review feedback - revert expire() to expireAt(), add parent::tearDown(), remove clearstatcache()
1 parent 1509087 commit 740154d

7 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎system/Cache/Handlers/PredisHandler.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function save(string $key, mixed $value, int $ttl = 60): bool
125125
}
126126

127127
if ($ttl !== 0) {
128-
$this->redis->expire($key, $ttl);
128+
$this->redis->expireat($key, Time::now()->getTimestamp() + $ttl);
129129
}
130130

131131
return true;

‎system/Cache/Handlers/RedisHandler.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function save(string $key, mixed $value, int $ttl = 60): bool
141141
}
142142

143143
if ($ttl !== 0) {
144-
$this->redis->expire($key, $ttl);
144+
$this->redis->expireAt($key, Time::now()->getTimestamp() + $ttl);
145145
}
146146

147147
return true;

‎tests/system/Cache/Handlers/ApcuHandlerTest.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ protected function setUp(): void
4141
protected function tearDown(): void
4242
{
4343
if (! isset($this->handler)) {
44+
parent::tearDown();
45+
4446
return;
4547
}
4648

4749
$this->handler->clean();
50+
51+
parent::tearDown();
4852
}
4953

5054
public function testNew(): void

‎tests/system/Cache/Handlers/FileHandlerTest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ protected function setUp(): void
5353
protected function tearDown(): void
5454
{
5555
parent::tearDown();
56-
clearstatcache();
5756

5857
if (is_dir($this->config->file['storePath'])) {
5958
chmod($this->config->file['storePath'], 0777);

‎tests/system/Cache/Handlers/MemcachedHandlerTest.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ protected function setUp(): void
4040
protected function tearDown(): void
4141
{
4242
if (! isset($this->handler)) {
43+
parent::tearDown();
44+
4345
return;
4446
}
4547

4648
$this->handler->clean();
49+
50+
parent::tearDown();
4751
}
4852

4953
public function testNew(): void

‎tests/system/Cache/Handlers/PredisHandlerTest.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ protected function setUp(): void
3838
protected function tearDown(): void
3939
{
4040
if (! isset($this->handler)) {
41+
parent::tearDown();
42+
4143
return;
4244
}
4345

4446
$this->handler->clean();
47+
48+
parent::tearDown();
4549
}
4650

4751
public function testNew(): void

‎tests/system/Cache/Handlers/RedisHandlerTest.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ protected function setUp(): void
4343
protected function tearDown(): void
4444
{
4545
if (! isset($this->handler)) {
46+
parent::tearDown();
47+
4648
return;
4749
}
4850

4951
$this->handler->clean();
52+
53+
parent::tearDown();
5054
}
5155

5256
public function testNew(): void

0 commit comments

Comments
 (0)