Skip to content

Commit ca5b98e

Browse files
committed
feat: APCu caching driver: fix
1 parent 79942cb commit ca5b98e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

system/Cache/Handlers/ApcuHandler.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ public function deleteMatching(string $pattern): int
9191
{
9292
$matchedKeys = array_filter(
9393
array_keys(iterator_to_array(new APCUIterator())),
94-
static fn ($key) => fnmatch($pattern, $key),
94+
static fn ($key): bool => fnmatch($pattern, $key),
9595
);
9696

97-
if ($matchedKeys) {
97+
if (! empty($matchedKeys)) {
9898
return count($matchedKeys) - count(apcu_delete($matchedKeys));
9999
}
100100

@@ -142,9 +142,10 @@ public function getCacheInfo(): array|false|object|null
142142
*/
143143
public function getMetaData(string $key): ?array
144144
{
145-
$key = static::validateKey($key, $this->prefix);
145+
$key = static::validateKey($key, $this->prefix);
146+
$metadata = apcu_key_info($key);
146147

147-
if ($metadata = apcu_key_info($key)) {
148+
if (! empty($metadata)) {
148149
return [
149150
'expire' => $metadata['ttl'] > 0 ? Time::now()->getTimestamp() + $metadata['ttl'] : null,
150151
'mtime' => $metadata['mtime'],

0 commit comments

Comments
 (0)