From 1432a7193d338b7945f2a285614f5068397d3fe9 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Tue, 11 Jun 2019 20:49:08 +0900 Subject: 設定でPostgreSQLのクエリー結果のキャッシュを無効できるように (#5046) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/types.ts | 1 + src/db/postgre.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/config/types.ts b/src/config/types.ts index c35bc63573..be3575d282 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -14,6 +14,7 @@ export type Source = { db: string; user: string; pass: string; + disableCache?: boolean; extra?: { [x: string]: string }; }; redis: { diff --git a/src/db/postgre.ts b/src/db/postgre.ts index f0f1e7eec0..c91cd8e1d7 100644 --- a/src/db/postgre.ts +++ b/src/db/postgre.ts @@ -96,7 +96,7 @@ export function initDb(justBorrow = false, sync = false, log = false) { extra: config.db.extra, synchronize: process.env.NODE_ENV === 'test' || sync, dropSchema: process.env.NODE_ENV === 'test' && !justBorrow, - cache: { + cache: !config.db.disableCache ? { type: 'redis', options: { host: config.redis.host, @@ -107,7 +107,7 @@ export function initDb(justBorrow = false, sync = false, log = false) { db: config.redis.db || 0 } } - }, + } : false, logging: log, logger: log ? new MyCustomLogger() : undefined, entities: [ -- cgit v1.2.3-freya