I am trying to use redis scan
with laravel. I can make a single request which returns 10 keys but I wish to loop until all the keys have been returned. I am unsure how to do this with laravel. Currently I have
$test = Redis::scan(0, 'match', '*keypattern*');
I don't know if there is a 'laravel' way of doing this.
EDIT:
I used composer to import predis/predis
and got it working with
use Predis\Collection\Iterator;
use Predis;
...
$client = new Predis\Client([
'scheme' => 'tcp',
'host' => 'localhost',
'port' => 6379,
]);
foreach (new Iterator\Keyspace($client, '*keypattern*') as $key) {
$arr[] = $key;
}
but I would like to know the laravel way
EDIT:
var_dump of the single Redis::scan
array(2) {
[0]=>
string(4) "23"
[1]=>
array(10) {
[0]=>
string(19) "key17"
[1]=>
string(19) "key72"
[2]=>
string(76) "key11"
[3]=>
string(19) "key73"
[4]=>
string(19) "key63"
[5]=>
string(19) "key87"
[6]=>
string(19) "key70"
[7]=>
string(19) "key65"
[8]=>
string(19) "key82"
[9]=>
string(19) "key43"
}
}