I'm using predis (with laravel if it makes any difference) php client to work with Redis.
I need to fetch all the keys from Redis that match certain prefix and I do it like this:
$keys = [];
foreach (new Iterator\Keyspace($this->redis(), Cache::KEY_PREFIX.'*') as $key) {
$keys[] = $rate_key;
}
After the work with those keys is done, operation repeats - I'm getting those keys again in again in a loop. I noticed that after a few iterations some keys are not included in $keys array.
The strangest thing is that keys that disappear never appear in next iterations. Restart of the php process (it's a daemon) fixes the problem.
I'm using Redis 3.0.2 with Predis 1.0 and PHP 5.4
P.S. Within the loop over keys, I change values for some of them. I'm not deleting any keys, however.