File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -15,19 +15,21 @@ function scan() {
1515 cursor = res [ 0 ] ;
1616
1717 // From <http://redis.io/commands/scan>:
18- // An iteration starts when the cursor is set to 0,
19- // and terminates when the cursor returned by the server is 0.
18+ // " An iteration starts when the cursor is set to 0,
19+ // and terminates when the cursor returned by the server is 0."
2020 if ( cursor === '0' ) {
2121 return console . log ( 'Iteration complete' ) ;
2222 } else {
23- // Remember, more keys than COUNT or no keys may be returned
23+ // Remember: more or less than COUNT or no keys may be returned
2424 // See http://redis.io/commands/scan#the-count-option
25+ // Also, SCAN may return the same key multiple times
26+ // See http://redis.io/commands/scan#scan-guarantees
27+
2528 if ( res [ 1 ] . length > 0 ) {
26- return console . log ( 'Array of matching keys' , res [ 1 ] ) ;
27- } else {
28- // No keys were returned in this scan, but more keys exist.
29- return scan ( ) ;
29+ console . log ( 'Array of matching keys' , res [ 1 ] ) ;
3030 }
31+
32+ return scan ( ) ;
3133 }
3234 }
3335 ) ;
You can’t perform that action at this time.
0 commit comments