Earlier, I used the KEYS command to find keys matching a specific pattern in my Redis database. Starting with Redis 2.8, the SCAN command seems preferable over KEYS because it returns an iterator instead of scanning the entire key space at once.
I am using Predis > = 0.8.5, which should 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 its SCAN :
$client->keys($pattern)
I tried the following:
$client->scan('MATCH', $pattern);
What kind of work - but it does not return a native PHP iterator. It would be very useful to use the built-in support for the Predis iterator.
php redis predis
André lazzlo
source share