hinos-redis
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

hinos-redis

A plugin helps to manage redis connection for hinos

Install

npm i hinos-redis -S

Examples

Typescript

Config redis information

import { Redis } from 'hinos-redis';

Redis({
    host: 'localhost'
})

Redis({
    key: 'connection1',
    host: 'localhost'
})

Use in service file

import { Redis, REDIS } from 'hinos-redis';

export class ChartService {
    @REDIS()
    static redis: Redis;
    
    @REDIS('connection1')
    static redis1: Redis;
    
    static async sendToRabbitmq(data: any = {}) {
        ChartService.redis.set('key', data, 60); // stored data and expired time is 60 secs
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i hinos-redis

Weekly Downloads

3

Version

2.0.5

License

ISC

Unpacked Size

35.9 kB

Total Files

11

Last publish

Collaborators

  • doanthuanthanh88