@ssut/nestjs-throttler-storage-redis
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

NestJS Throttler Redis Storage

Tests status

Redis storage provider for the @nestjs/throttler package.

Installation

Yarn

  • yarn add @ssut/nestjs-throttler-storage-redis ioredis

NPM

  • npm install --save @ssut/nestjs-throttler-storage-redis ioredis

Usage

import { ThrottlerModule } from '';
import { ThrottlerStorageRedisService } from '-storage-redis';

@Module({
  imports: [
    ThrottlerModule.forRoot({
      ttl: 60,
      limit: 5,
      storage: new ThrottlerStorageRedisService(),
    }),
  ],
})
export class AppModule {}
import { ThrottlerModule } from '';
import { ThrottlerStorageRedisService } from '-storage-redis';

@Module({
  imports: [
    ThrottlerModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        ttl: config.get('THROTTLE_TTL'),
        limit: config.get('THROTTLE_LIMIT'),
        storage: new ThrottlerStorageRedisService(),
      }),
    }),
  ],
})
export class AppModule {}

Issues

Bugs and features related to the redis implementation are welcome in this repository.

License

NestJS Throttler Redis Storage is licensed under the MIT license.

Package Sidebar

Install

npm i @ssut/nestjs-throttler-storage-redis

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

132 kB

Total Files

17

Last publish

Collaborators

  • ssut