在redis中除了key 外有没有科学的方法来遍历redis
以下为thinkphp5代码
```
scanGetKeys("*prize_list*");
foreach($scanlist as $k=>$v){
Cache::store('redis')->rawCommand("del", $v);
}
public function scanGetKeys($pattern, $count = 50){
$ret = [];
$iterator = 0;
while (true) {
$result = Cache::store('redis')->rawCommand("scan", $iterator, 'match', $pattern, 'count', $count);
//dump($result);
if ($result === false) {
break;
}
$ret = array_merge($ret, $result[1]);
$iterator = $result[0];
if($result[0] == 0){
break;
}
}
return $ret;
}
```