1.0.1 • Published 6 years ago

salak-redis v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

salak-redis

NPM version build status David deps NPM download

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