const redis = require('redis')
// 连接redis
const client = redis.createClient(6379, '127.0.0.1')
client.on('error', console.error)
module.exports = client
const rc = require('./db/redis')
const { promisify } = require('util')
const getAsync = promisify(rc.get).bind(rc)
rc.set('name', 'nanjing')
rc.expire('name', 10)
rc.get('name', (err, val) => {
console.log(val)
})
getAsync('name').then(console.log)
console.log(rc.exists('name'))