1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-11 22:42:42 +03:00
Files
node-redis/examples/unix_socket.js
Ruben Bridgewater b2613b2270 test fixup
2017-05-06 08:16:19 +02:00

34 lines
608 B
JavaScript

'use strict'
const redis = require('redis')
const client = redis.createClient('/tmp/redis.sock')
const profiler = require('v8-profiler')
client.on('connect', () => {
console.log('Got Unix socket connection.')
})
client.on('error', (err) => {
console.log(err.message)
})
client.set('space chars', 'space value')
setInterval(() => {
client.get('space chars')
}, 100)
function done () {
client.info((err, reply) => {
if (err) throw err
console.log(reply.toString())
client.quit()
})
}
setTimeout(() => {
console.log('Taking snapshot.')
profiler.takeSnapshot()
done()
}, 5000)