@notadd/addon-redis
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

nt-addon-redis

Redis addon for Notadd.

Installation

# install
$ npm install @notadd/addon-redis

or

$ yarn add @notadd/addon-redis

Usage

app.module.ts

import { Module } from '@nestjs/common';
import { RedisAddon } from '@notadd/addon-redis'

@Module({
    import: [
        RedisAddon.forRoot({
            // redis connection options, such as host, port, etc
        })
    ]
})
export AppModule { }

xxx.service.ts

import { Injectable } from '@nestjs/common';
import { RedisService } from '@notadd/addon-redis';

@Injectable()
export class TestService {
    constructor(
        @Inject(RedisService) private readonly redisService: RedisService
    ) { }

    // service method usage
    async test() {
        // redis hset
        await this.redisService.hset(key, field, value);
        // redis hget
        await this.redisService.hget(key, field);
    }
}

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @notadd/addon-redis

    Weekly Downloads

    0

    Version

    0.1.3

    License

    Apache-2.0

    Unpacked Size

    24.7 kB

    Total Files

    23

    Last publish

    Collaborators

    • imeepos2
    • tian-hun
    • lei3265018
    • zuohuadong