mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 08:12:40 +00:00
add cachemodule
This commit is contained in:
@@ -8,6 +8,9 @@ import { MatchProfile } from './mappers/match.profile';
|
||||
import { AdRepository } from './adapters/secondaries/ad.repository';
|
||||
import { MatchUseCase } from './domain/usecases/match.usecase';
|
||||
import { Messager } from './adapters/secondaries/messager';
|
||||
import { CacheModule } from '@nestjs/cache-manager';
|
||||
import { RedisClientOptions } from '@liaoliaots/nestjs-redis';
|
||||
import { redisStore } from 'cache-manager-ioredis-yet';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -27,6 +30,18 @@ import { Messager } from './adapters/secondaries/messager';
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
CacheModule.registerAsync<RedisClientOptions>({
|
||||
imports: [ConfigModule],
|
||||
useFactory: async (configService: ConfigService) => ({
|
||||
store: await redisStore({
|
||||
host: configService.get<string>('REDIS_HOST'),
|
||||
port: configService.get<number>('REDIS_PORT'),
|
||||
password: configService.get<string>('REDIS_PASSWORD'),
|
||||
ttl: configService.get<number>('CACHE_TTL'),
|
||||
}),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
],
|
||||
controllers: [MatcherController],
|
||||
providers: [MatchProfile, AdRepository, Messager, MatchUseCase],
|
||||
|
||||
Reference in New Issue
Block a user