1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/examples/subquery.js
2017-05-06 01:49:05 +02:00

18 lines
489 B
JavaScript

'use strict';
var client = require('redis').createClient();
// build a map of all keys and their types
client.keys('*', function (err, allKeys) {
var keyTypes = {};
allKeys.forEach(function (key, pos) { // use second arg of forEach to get pos
client.type(key, function (err, type) {
keyTypes[key] = type;
if (pos === allKeys.length - 1) { // callbacks all run in order
console.dir(keyTypes);
}
});
});
});