Skip to content

Commit

Permalink
Update: 优化实现
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX authored Apr 6, 2024
1 parent f653596 commit 9060264
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Cache/Handler/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,19 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable
{
$parsedKeys[$i] = $this->parseKey($key);
}
unset($key);
$mgetResult = ImiRedis::use(static fn (\Imi\Redis\RedisHandler $redis) => $redis->mget($parsedKeys), $this->poolName, true);
$result = [];
if ($mgetResult)
{
foreach ($mgetResult as $i => $v)
{
$key = $keys[$i];

if (false === $v)
{
$result[$key] = $default;
$result[$keys[$i]] = $default;
}
else
{
$result[$key] = $this->decode($v);
$result[$keys[$i]] = $this->decode($v);
}
}
}
Expand Down

0 comments on commit 9060264

Please sign in to comment.