Skip to content

Commit

Permalink
chore: add ioredis
Browse files Browse the repository at this point in the history
  • Loading branch information
mdwitr0 committed Jul 1, 2023
1 parent 98df996 commit edc502b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
39 changes: 27 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@fastify/compress": "^6.2.0",
"@fastify/helmet": "^10.1.0",
"@fastify/static": "^6.9.0",
"@liaoliaots/nestjs-redis": "^9.0.5",
"@nestjs/axios": "^2.0.0",
"@nestjs/cache-manager": "^1.0.0",
"@nestjs/common": "^9.0.0",
Expand All @@ -45,6 +46,7 @@
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"eslint-plugin-unused-imports": "^2.0.0",
"ioredis": "^5.3.2",
"luxon": "^3.2.1",
"meilisearch": "^0.32.0",
"mongoose": "^6.9.0",
Expand Down
2 changes: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { ThrottlerGuard } from '@nestjs/throttler';
import { APP_GUARD } from '@nestjs/core';
import { CacheConfig } from './common/configs/cache.config';
import { ThrottlerConfig } from './common/configs/throttler.config';
import { RedisConfig } from './common/configs/redis.config';

const imports = [
LoggerModule.forRoot(
Expand Down Expand Up @@ -68,6 +69,7 @@ const imports = [
},
}),
}),
RedisConfig,
MeiliSearchModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
Expand Down
12 changes: 12 additions & 0 deletions src/common/configs/redis.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ConfigModule, ConfigService } from '@nestjs/config';
import { RedisModule } from '@liaoliaots/nestjs-redis';

export const RedisConfig = RedisModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
config: {
url: configService.get<string>('REDIS_URL'),
},
}),
});

0 comments on commit edc502b

Please sign in to comment.