22 lines
525 B
TypeScript
22 lines
525 B
TypeScript
|
import { CacheModule } from '@nestjs/cache-manager';
|
||
|
import { Module } from '@nestjs/common';
|
||
|
import { redisStore } from 'cache-manager-redis-yet';
|
||
|
import { RedisModule } from '../redis/redis.module';
|
||
|
|
||
|
@Module({
|
||
|
imports: [
|
||
|
CacheModule.registerAsync({
|
||
|
imports: [RedisModule],
|
||
|
useFactory: (redisUrl: string) => {
|
||
|
return {
|
||
|
store: redisStore,
|
||
|
url: redisUrl,
|
||
|
};
|
||
|
},
|
||
|
inject: ['REDIS_URL'],
|
||
|
}),
|
||
|
],
|
||
|
exports: [CacheModule],
|
||
|
})
|
||
|
export class CommonCacheModule {}
|