You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Small style changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var redis = require("redis"),
|
||||
var redis = require('redis'),
|
||||
client = redis.createClient();
|
||||
|
||||
var cursor = '0';
|
||||
@@ -8,8 +8,8 @@ var cursor = '0';
|
||||
function scan() {
|
||||
client.scan(
|
||||
cursor,
|
||||
"MATCH", "q:job:*",
|
||||
"COUNT", "10",
|
||||
'MATCH', 'q:job:*',
|
||||
'COUNT', '10',
|
||||
function(err, res) {
|
||||
if (err) throw err;
|
||||
|
||||
@@ -17,22 +17,21 @@ function scan() {
|
||||
cursor = res[0];
|
||||
|
||||
// From <http://redis.io/commands/scan>:
|
||||
// "An iteration starts when the cursor is set to 0,
|
||||
// and terminates when the cursor returned by the server is 0."
|
||||
// 'An iteration starts when the cursor is set to 0,
|
||||
// and terminates when the cursor returned by the server is 0.'
|
||||
if (cursor === '0') {
|
||||
return console.log('Iteration complete');
|
||||
} else {
|
||||
// Remember: more or less than COUNT or no keys may be returned
|
||||
// See http://redis.io/commands/scan#the-count-option
|
||||
// Also, SCAN may return the same key multiple times
|
||||
// See http://redis.io/commands/scan#scan-guarantees
|
||||
|
||||
if (res[1].length > 0) {
|
||||
console.log('Array of matching keys', res[1]);
|
||||
}
|
||||
|
||||
return scan();
|
||||
}
|
||||
// Remember: more or less than COUNT or no keys may be returned
|
||||
// See http://redis.io/commands/scan#the-count-option
|
||||
// Also, SCAN may return the same key multiple times
|
||||
// See http://redis.io/commands/scan#scan-guarantees
|
||||
|
||||
if (res[1].length > 0) {
|
||||
console.log('Array of matching keys', res[1]);
|
||||
}
|
||||
|
||||
return scan();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user