salak-redis
v1.0.1
Published
Redis for salak.
Downloads
23
Readme
salak-redis
Redis for SalakJS.
Install
$ npm install --save salak-redis
Usage
Config
In middleware:
module.exports = {
middleware: [
{
name: 'redis',
package: require('salak-redis')
}
],
redis: {
host: '127.0.0.1',
port: 6379
}
}
options: ref to redis
Use in Service or Controller
common/service/user.js
const { Service } = require('salak')
class User extends Service {
async findUserInfo (uid) {
const info = await this.redis.getAsync(uid)
return info
}
}
module.exports = User