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

0.1.1 • Public • Published

Moleculer d1soft / Redis

Redis mixin for moleculer

Install

npm add -E ioredis @moleculer-d1soft/redis

Example

import { Service as MoleculerService, ServiceBroker, ServiceSettingSchema } from 'moleculer';
import { Service } from 'moleculer-decorators';
import { RedisMixin, RedisMixinOptions } from '@bukusaya/redis';

interface SomeServiceSettings extends ServiceSettingSchema, RedisMixinOptions {}

@Service({
    name: 'some-service',
    version: 1,
    settings: {
      redisHost: process.env.REDIS_HOST || 'localhost',
      redisPort: Number(process.env.REDIS_PORT) || 6379,
      redisPassword: process.env.REDIS_PASSWORD || '',
      redisDatabase: Number(process.env.REDIS_DATABASE) || 0,

      $secureSettings: ['redisPassword']
    },
    mixins: [new RedisMixin()]
})
export default class SomeService extends MoleculerService<SomeServiceSettings> {
  protected connection?: IORedis;

	public constructor(public broker: ServiceBroker) {
		super(broker);
	}
}

Readme

Keywords

none

Package Sidebar

Install

npm i @moleculer-d1soft/redis

Weekly Downloads

0

Version

0.1.1

License

ISC

Unpacked Size

5.56 kB

Total Files

11

Last publish

Collaborators

  • d1soft