redis scan迭代模糊匹配

流火行者發表於2018-10-26
$redis = new Redis();
$redis->connect('localhost', 6379);
 
$iterator = null;
while (true) {
    $keys = $redis->scan($iterator, 'test*');
    if ($keys === false) {//迭代結束,未找到匹配pattern的key
        return;
    }
    foreach ($keys as $key) {
        echo $key . PHP_EOL;
    }

 

scan 0 match a* count 2

相關文章