diff --git a/.config/ci.yml b/.config/ci.yml index 5657b8beae..7d5261aacd 100644 --- a/.config/ci.yml +++ b/.config/ci.yml @@ -115,8 +115,10 @@ db: user: postgres pass: ci - # Whether disable Caching queries - #disableCache: true + # If false, then query results will be cached in redis. + # If true (default), then queries will not be cached. + # This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior. + #disableCache: false # Extra Connection options #extra: diff --git a/.config/cypress-devcontainer.yml b/.config/cypress-devcontainer.yml index ca62616462..51f408983c 100644 --- a/.config/cypress-devcontainer.yml +++ b/.config/cypress-devcontainer.yml @@ -57,8 +57,10 @@ db: user: postgres pass: postgres - # Whether disable Caching queries - #disableCache: true + # If false, then query results will be cached in redis. + # If true (default), then queries will not be cached. + # This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior. + #disableCache: false # Extra Connection options #extra: diff --git a/.config/docker_example.yml b/.config/docker_example.yml index df5d77a97f..1b55eee7f5 100644 --- a/.config/docker_example.yml +++ b/.config/docker_example.yml @@ -118,8 +118,10 @@ db: user: example-misskey-user pass: example-misskey-pass - # Whether disable Caching queries - #disableCache: true + # If false, then query results will be cached in redis. + # If true (default), then queries will not be cached. + # This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior. + #disableCache: false # Extra Connection options #extra: diff --git a/.config/example.yml b/.config/example.yml index 9e2b6d6da5..b7843da9ad 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -121,8 +121,12 @@ db: user: sharkey pass: example-misskey-pass - # Whether disable Caching queries - #disableCache: true + # If false, then query results will be cached in redis. + # If true (default), then queries will not be cached. + # This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior. + #disableCache: false + + # # Extra Connection options #extra: diff --git a/packages/backend/src/postgres.ts b/packages/backend/src/postgres.ts index 632fd58927..34fca6dd92 100644 --- a/packages/backend/src/postgres.ts +++ b/packages/backend/src/postgres.ts @@ -306,7 +306,7 @@ export function createPostgresDataSource(config: Config) { } : {}), synchronize: process.env.NODE_ENV === 'test', dropSchema: process.env.NODE_ENV === 'test', - cache: !config.db.disableCache && process.env.NODE_ENV !== 'test' ? { // dbをcloseしても何故かredisのコネクションが内部的に残り続けるようで、テストの際に支障が出るため無効にする(キャッシュも含めてテストしたいため本当は有効にしたいが...) + cache: config.db.disableCache === false && process.env.NODE_ENV !== 'test' ? { // dbをcloseしても何故かredisのコネクションが内部的に残り続けるようで、テストの際に支障が出るため無効にする(キャッシュも含めてテストしたいため本当は有効にしたいが...) type: 'ioredis', options: { ...config.redis,