implement redis cache for context
This commit is contained in:
@@ -2,6 +2,7 @@ import { Global, MiddlewareConsumer, Module } from '@nestjs/common';
|
||||
|
||||
import { AdminNoteModule } from '../AdminNote/adminnote.module';
|
||||
import { ApolloDriverConfig } from '@nestjs/apollo';
|
||||
import { AppConfigModule } from '../AppConfig/appconfig.module';
|
||||
import { Builder } from './graphql.builder';
|
||||
import { CategoryModule } from '../Category/category.module';
|
||||
import { CenterMentorModule } from '../CenterMentor/centermentor.module';
|
||||
@@ -21,6 +22,8 @@ import { PothosModule } from '@smatch-corp/nestjs-pothos';
|
||||
import { PrismaCrudGenerator } from './graphql.generator';
|
||||
import { PrismaModule } from '../Prisma/prisma.module';
|
||||
import { PrismaService } from '../Prisma/prisma.service';
|
||||
import { RedisModule } from 'src/Redis/redis.module';
|
||||
import { RedisService } from 'src/Redis/redis.service';
|
||||
import { RefundTicketModule } from '../RefundTicket/refundticket.module';
|
||||
import { Request } from 'express';
|
||||
import { ResumeModule } from '../Resume/resume.module';
|
||||
@@ -42,6 +45,8 @@ import { initContextCache } from '@pothos/core';
|
||||
imports: [
|
||||
CommonModule,
|
||||
PrismaModule,
|
||||
RedisModule,
|
||||
AppConfigModule,
|
||||
UserModule,
|
||||
CenterModule,
|
||||
ServiceModule,
|
||||
@@ -93,8 +98,9 @@ import { initContextCache } from '@pothos/core';
|
||||
providers: [
|
||||
{
|
||||
provide: GraphqlService,
|
||||
useFactory: (prisma: PrismaService) => new GraphqlService(prisma),
|
||||
inject: [PrismaService],
|
||||
useFactory: (prisma: PrismaService, redis: RedisService) =>
|
||||
new GraphqlService(prisma, redis),
|
||||
inject: [PrismaService, 'REDIS_CLIENT'],
|
||||
},
|
||||
{
|
||||
provide: Builder,
|
||||
|
||||
Reference in New Issue
Block a user