Skip to content

Commit

Permalink
BC-6341 Revert Redis update (#4712)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper authored Jan 23, 2024
1 parent e2186d5 commit f02297d
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 390 deletions.
9 changes: 5 additions & 4 deletions apps/server/src/infra/cache/cache.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib';
import { CacheModule, CacheModuleOptions } from '@nestjs/cache-manager';
import { Module } from '@nestjs/common';
import { LegacyLogger, LoggerModule } from '@src/core/logger';
import { redisStore } from 'cache-manager-redis-yet';
import { create } from 'cache-manager-redis-store';
import { RedisClient } from 'redis';
import { CacheStoreType } from './interface';
import { CacheService } from './service/cache.service';

@Module({
imports: [
CacheModule.registerAsync({
useFactory: async (cacheService: CacheService, logger: LegacyLogger): Promise<CacheModuleOptions> => {
useFactory: (cacheService: CacheService, logger: LegacyLogger): CacheModuleOptions => {
if (cacheService.getStoreType() === CacheStoreType.REDIS) {
const redisUrl: string = Configuration.get('REDIS_URI') as string;
const store = await redisStore({ url: redisUrl });
const { client } = store;
const store = create({ url: redisUrl });
const client: RedisClient = store.getClient();

client.on('error', (error) => logger.error(error));
client.on('connect', (msg) => logger.log(msg));
Expand Down
Loading

0 comments on commit f02297d

Please sign in to comment.