Skip to content

Compatibility with CacheModule @nestjs/cache-manager #9

@armujahid

Description

@armujahid

I think It shouldn't depend on RedisModule from '@liaoliaots/nestjs-redis. It should work with official CacheModule from @nestjs/cache-manager

    CacheModule.registerAsync<RedisClientOptions>({
      isGlobal: true,
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: async (configService: ConfigService) => {
        const store = await redisStore({
          clusterConfig: {
            nodes:[
              {
                host: configService.get('REDIS_HOST'),
                port: configService.get('REDIS_PORT'),
              }
            ],
            options: {
              enableOfflineQueue: true,
            }
          }
        });
        return {
          store: store as unknown as CacheStore,
        };
      }
    }),
    RedisLockModule.register({}), // import RedisLockModule, use default configuration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions