feat(cacheservice): add suport to use use redis in cacheservice

This commit is contained in:
jaison-x
2024-01-12 15:58:11 -03:00
parent ba9f97bc3e
commit 2d8b5f04e9
14 changed files with 351 additions and 48 deletions

View File

@@ -131,6 +131,7 @@ import { MessageUpQuery } from '../repository/messageUp.repository';
import { RepositoryBroker } from '../repository/repository.manager';
import { Events, MessageSubtype, TypeMediaMessage, wa } from '../types/wa.types';
import { waMonitor } from '../whatsapp.module';
import { CacheService } from './cache.service';
import { ChamaaiService } from './chamaai.service';
import { ChatwootService } from './chatwoot.service';
import { TypebotService } from './typebot.service';
@@ -143,6 +144,7 @@ export class WAStartupService {
private readonly eventEmitter: EventEmitter2,
private readonly repository: RepositoryBroker,
private readonly cache: RedisCache,
private readonly chatwootCache: CacheService,
) {
this.logger.verbose('WAStartupService initialized');
this.cleanStore();
@@ -170,7 +172,7 @@ export class WAStartupService {
private phoneNumber: string;
private chatwootService = new ChatwootService(waMonitor, this.configService, this.repository);
private chatwootService = new ChatwootService(waMonitor, this.configService, this.repository, this.chatwootCache);
private typebotService = new TypebotService(waMonitor, this.configService, this.eventEmitter);
@@ -408,7 +410,7 @@ export class WAStartupService {
this.logger.verbose('Removing cache from chatwoot');
if (this.localChatwoot.enabled) {
this.chatwootService.getCache().deleteAll();
this.chatwootService.getCache()?.deleteAll(this.instanceName);
}
}