/usr/share/doc/node-redis/examples/subquery.js is in node-redis 0.12.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | var client = require("redis").createClient();
function print_results(obj) {
console.dir(obj);
}
// build a map of all keys and their types
client.keys("*", function (err, all_keys) {
var key_types = {};
all_keys.forEach(function (key, pos) { // use second arg of forEach to get pos
client.type(key, function (err, type) {
key_types[key] = type;
if (pos === all_keys.length - 1) { // callbacks all run in order
print_results(key_types);
}
});
});
});
|