Skip to content

Instantly share code, notes, and snippets.

@Fabryz
Created June 18, 2013 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fabryz/5805482 to your computer and use it in GitHub Desktop.
Save Fabryz/5805482 to your computer and use it in GitHub Desktop.
client.keys("*", function(err, keys) {
if (err) throw err;
console.log(keys); // OK
var response = [];
for (var i = 0; i < keys.length; i++) {
client.hget(keys[i], "count", function(err, value) {
if (err) throw err;
console.log( keys[i] +": "+ value); // undefined: value
response.push({ key: keys[i], count: value });
});
}
}
var parsed = ["test1", "test2" ... "test0921309"];
for (var i = 0; i < parsed.length; i++) {
client.hincrby(parsed[i], "count", 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment