A redis client tools for nodejs and want to look for a girlfriend...
$ npm i ai-redis-client
const redisClient = key => {
// https://www.npmjs.com/package/@blued-core/qconf
return createRedisClient({ key, option: qconf })()
// or
return createRedisClient({ master: ['127.0.0.1:6379'] }, key)()
}
async function getTest () {
const userRedis = redisClient('user')
const res = await userRedis.hgetall('u:113').catch(err => {
console.error(err, { tips: 'test -> hgetall error' })
})
console.log(res)
return res
}
// options
interface Config {
key?: string
time?: number
option: any
}
interface Redis {
master: Array<string>
password?: string
db?: number
}