INNER CODE UNIT · TypeScript

ThrottlerStorageRedisService

kkoomen/nestjs-throttler-storage-redis · src/throttler-storage-redis.service.ts:7

export class ThrottlerStorageRedisService implements ThrottlerStorageRedis, OnModuleDestroy {
  scriptSrc: string;
  redis: Redis | Cluster;
  disconnectRequired?: boolean;

  constructor(redis?: Redis);
  constructor(cluster?: Cluster);
  constructor(options?: RedisOptions);
  constructor(url?: string);
  constructor(redisOrOptions?: Redis | Cluster | RedisOptions | string) {
    if (redisOrOptions instanceof Redis || redisOrOptions instanceof Cluster) {
      this.redis = redisOrOptions;
    } else if (typeof redisOrOptions === 'string') {
      this.redis = new Redis(redisOrOptions as string);
      this.disconnectRequired = true;
    } else {
      this.redis = new Redis(redisOrOptions as RedisOptions);
      this.disconnectRequired = true;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…