3

I have set of of hashes

taxi:1 p1 v1 p2 v2 ...
taxi:2 p1 v3 p2 v4 ...
taxi:3 p1 v5 p2 v6 ...
taxi:4 p1 v1 p2 v7 ...

How do I iterate through them efficiently.

My goal is to display some cards with data in a Blade template.

dbr
  • 1,037
  • 14
  • 34

1 Answers1

0

I did this in my Controller

$arr = [];
//foreach($redis->keys('taxi*') as $t)
    foreach(new Iterator\Keyspace($redis, 'group_location*') as $groupLocation)
{
    $arr[] = $redis->hscan($t,1)[1];
}

which returned me what I needed.

However, I have a feeling this is running count($redis->keys('taxti*')) calls to the Redis which seems like a thing that should be avoided.

dbr
  • 1,037
  • 14
  • 34