1.1.1 • Published 4 days ago

@goopen/nestjs-ioredis-provider v1.1.1

Weekly downloads
-
License
BSD
Repository
github
Last release
4 days ago

NestJS provider for ioredis client and cluster

1. Install

npm install @goopen/nestjs-ioredis-provider ioredis

2. Register the provider

@Module({
  imports: [
    RedisModule.register({
      url: redisUrl,
      isGlobal: true,
    }),
  ],
})
export class AppModule {}

3. You're then able to use the injector to use the Redis

@Injectable()
export class AppService{
  constructor(
    @InjectRedis() private readonly redisClient: Redis,
  ) {}
}

The library also provides a health indicator that can be used with terminus

1. Import health indicator

@Module({
  imports: [TerminusModule],
  providers: [HealthService, RedisHealthIndicator],
})
export class HealthModule {}

2. Use isHealthy method from health indicator

@Injectable()
export class HealthService{
  constructor(
    private redis: RedisHealthIndicator,
  ) {}

  pingRedis() {
    return () => this.redis.isHealthy('redis');
  }
}
1.1.1

4 days ago

1.0.2

11 months ago

1.1.0

11 months ago

1.0.1

1 year ago

1.0.0

1 year ago