0.0.9 • Published 4 years ago

@bitbeat/redis v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

BITBEAT REDIS MODULE

Introduction

This is the official redis module for bitbeat using ioredis for connection. This package will export you a redis connector and a redis config. To use it follow the documentation of bitbeat at the homepage.

Example register:

import { registerBulk } from '@bitbeat/core';
import { RedisConnector, RedisConfig } from '@bitbeat/redis';

export default async () => {
    // it does not matter if you use new Set([RedisConfig, RedisConnector]) or new Set([RedisConnector, RedisConfig]).
    // Configuration files will always be loaded first + the priorities are the important sorter.
    await registerBulk(new Set([RedisConfig, RedisConnector]));
};

Example usage:

import { getInstance, Task } from '@bitbeat/core';
import { RedisConnector } from '@bitbeat/redis';

export default class Test extends Task {
    constructor() {
        super();
        this.schedule = '* * * * *';
    }

    async run(): Promise<void> {
        // set each minute a new timestamp
        const redis = getInstance(RedisConnector)?.runtime;
        await redis.set('timestamp', Date.now());
    }
}
0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago