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