Du kan bruge scan
kommando tilgængelig i redis fra version 2.8.0. Se dokumentationen fra http://redis.io/commands/scan.
Eksempelkode:
var cursor = '0';
function scan(){
redisClient.scan(cursor, 'MATCH', 'CM:*', 'COUNT', '5', function(err, reply){
if(err){
throw err;
}
cursor = reply[0];
if(cursor === '0'){
return console.log('Scan Complete');
}else{
// do your processing
// reply[1] is an array of matched keys.
// console.log(reply[1]);
return scan();
}
});
}
scan(); //call scan function