I have previously used the KEYS command to search for keys matching a certain pattern in my Redis database. Since Redis 2.8, the SCAN command seems to be preferred over KEYS since it returns an iterator instead of scanning through the whole keyspace at once.
I'm using Predis >= 0.8.5 which is supposed to support PHP iterators for the SCAN command. Predis doesn't have a lot of documentation, so I'm wondering how to translate the following KEYS command to it's SCAN counterpart:
$client->keys($pattern)
I have tried the following:
$client->scan('MATCH', $pattern);
Which kind of works - but it doesn't return a native PHP iterator. It would be really nice to use Predis' built-in iterator support.