mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.0 KiB
28 lines
1.0 KiB
import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
|
|
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';
|
|
import { CacheModule, Module } from '@nestjs/common';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import * as redisStore from 'cache-manager-redis-store';
|
|
|
|
import { RedisCacheService } from './redis-cache.service';
|
|
|
|
@Module({
|
|
imports: [
|
|
CacheModule.registerAsync({
|
|
imports: [ConfigModule],
|
|
inject: [ConfigService],
|
|
useFactory: async (configurationService: ConfigurationService) => ({
|
|
host: configurationService.get('REDIS_HOST'),
|
|
max: configurationService.get('MAX_ITEM_IN_CACHE'),
|
|
port: configurationService.get('REDIS_PORT'),
|
|
password: configurationService.get('REDIS_PASSWORD'),
|
|
store: redisStore,
|
|
ttl: configurationService.get('CACHE_TTL')
|
|
})
|
|
}),
|
|
ConfigurationModule
|
|
],
|
|
providers: [RedisCacheService],
|
|
exports: [RedisCacheService]
|
|
})
|
|
export class RedisCacheModule {}
|
|
|