redis scan迭代模糊匹配

$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

posted @ 2018-10-26 10:51  流火行者  阅读(1201)  评论(0编辑  收藏  举报