diff --git a/src/common/constants/policy.constant.ts b/src/common/constants/policy.constant.ts index 1c9d167..4b5d435 100644 --- a/src/common/constants/policy.constant.ts +++ b/src/common/constants/policy.constant.ts @@ -12,6 +12,6 @@ export const TEMPLATE_DIRECTORY = path.join(__dirname, '../../../', 'template'); export const LIFECYCLE_INTERVAL = 1000 * 10; // redis 는 도커 컨테이너에 내장되어 있습니다. -export const REDIS_HOST = 'localhost'; -export const REDIS_PORT = 6379; -export const REDIS_TTL = 0; +// export const REDIS_HOST = 'localhost'; +// export const REDIS_PORT = 6379; +// export const REDIS_TTL = 0; diff --git a/src/libs/cache-db/cache-db.module.ts b/src/libs/cache-db/cache-db.module.ts index 3302bed..ea8274f 100644 --- a/src/libs/cache-db/cache-db.module.ts +++ b/src/libs/cache-db/cache-db.module.ts @@ -1,25 +1,25 @@ import { CacheModule, Global, Module } from '@nestjs/common'; import * as redisStore from 'cache-manager-redis-store'; import { CacheDBService } from './cache-db.service'; -import { - REDIS_HOST, - REDIS_PORT, - REDIS_TTL, -} from '../../common/constants/policy.constant'; +// import { +// REDIS_HOST, +// REDIS_PORT, +// REDIS_TTL, +// } from '../../common/constants/policy.constant'; -export const cacheModule = CacheModule.registerAsync({ - useFactory: async () => ({ - store: redisStore, - host: REDIS_HOST, - port: `${REDIS_PORT}`, - ttl: REDIS_TTL, - auth_pass: '', - }), -}); +// export const cacheModule = CacheModule.registerAsync({ +// useFactory: async () => ({ +// store: redisStore, +// host: REDIS_HOST, +// port: `${REDIS_PORT}`, +// ttl: REDIS_TTL, +// auth_pass: '', +// }), +// }); @Global() @Module({ - imports: [cacheModule], + // imports: [cacheModule], providers: [CacheDBService], exports: [CacheDBService], }) diff --git a/src/libs/cache-db/cache-db.service.ts b/src/libs/cache-db/cache-db.service.ts index 4fe5c3c..0b890f5 100644 --- a/src/libs/cache-db/cache-db.service.ts +++ b/src/libs/cache-db/cache-db.service.ts @@ -3,34 +3,33 @@ import { Cache } from 'cache-manager'; @Injectable() export class CacheDBService { - constructor( - @Inject(CACHE_MANAGER) - private readonly cacheManager: Cache, - ) {} + constructor() // @Inject(CACHE_MANAGER) + // private readonly cacheManager: Cache, + {} - async set(key: string, value: T, ttl = -1) { - if (ttl === -1) { - return this.cacheManager.set(key, value); - } else { - return this.cacheManager.set(key, value, { - ttl, - }); - } - } - - async get(key: string) { - return this.cacheManager.get(key); - } - - async getKeys() { - return this.cacheManager.store.keys(); - } - - async del(key: string) { - return this.cacheManager.del(key); - } - - getCacheManager(): Cache { - return this.cacheManager; - } + // async set(key: string, value: T, ttl = -1) { + // if (ttl === -1) { + // return this.cacheManager.set(key, value); + // } else { + // return this.cacheManager.set(key, value, { + // ttl, + // }); + // } + // } + // + // async get(key: string) { + // return this.cacheManager.get(key); + // } + // + // async getKeys() { + // return this.cacheManager.store.keys(); + // } + // + // async del(key: string) { + // return this.cacheManager.del(key); + // } + // + // getCacheManager(): Cache { + // return this.cacheManager; + // } }