* [refac] check variable's type before using it as an array.

This commit is contained in:
liugang
2024-12-11 09:39:41 +08:00
committed by 朱金勇
parent f2eb2711c8
commit 73d1b4cea1
+2 -1
View File
@@ -160,6 +160,7 @@ class RedisDriver implements CacheInterface
while($cachedKeys = $this->redis->scan($it, $this->namespace . $this->connector . '*'))
{
if(!is_array($cachedKeys)) break;
$keys = array_merge($keys, $cachedKeys);
}
@@ -176,7 +177,7 @@ class RedisDriver implements CacheInterface
public function getMultiple($keys, $default = null)
{
$result = $this->redis->mget($keys);
if(!$result) return [];
if(!is_array($result)) return [];
return array_filter(array_combine($keys, $result));
}