You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
20 lines
472 B
JavaScript
20 lines
472 B
JavaScript
'use strict'
|
|
|
|
// Sending commands in response to other commands.
|
|
// This example runs 'type' against every key in the database
|
|
//
|
|
var client = require('redis').createClient()
|
|
|
|
client.keys('*', function (err, keys) {
|
|
if (err) throw err
|
|
keys.forEach(function (key, pos) {
|
|
client.type(key, function (err, keytype) {
|
|
if (err) throw err
|
|
console.log(key + ' is ' + keytype)
|
|
if (pos === (keys.length - 1)) {
|
|
client.quit()
|
|
}
|
|
})
|
|
})
|
|
})
|