From a040b021ceabbe578c43ca782c9672c10bbc33da Mon Sep 17 00:00:00 2001 From: Tanya Byrne Date: Wed, 19 Aug 2020 19:10:57 +0100 Subject: [PATCH] Adding to the config so we can pick what kind of caching --- api/example.env | 4 ++++ api/src/cli/utils/create-env/index.ts | 4 +++- api/src/services/node-cache.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/example.env b/api/example.env index d148c411d5..0140abbe19 100644 --- a/api/example.env +++ b/api/example.env @@ -37,6 +37,10 @@ BLOCK_POINT_DURATION=0 INMEMORY_BLOCK_CONSUMED=200 INMEMEMORY_BLOCK_DURATION=30 #################################################################################################### +# Caching + +CACHE_TYPE="redis" +#################################################################################################### # File Storage STORAGE_LOCATIONS="local, digitalocean" diff --git a/api/src/cli/utils/create-env/index.ts b/api/src/cli/utils/create-env/index.ts index 8272b119ac..057a4c48ae 100644 --- a/api/src/cli/utils/create-env/index.ts +++ b/api/src/cli/utils/create-env/index.ts @@ -32,7 +32,6 @@ const defaults = { }, rateLimits: { RATE_LIMIT_TYPE: 'redis', - CACHE_TYPE: 'redis', CONSUMED_POINTS_LIMIT: 5, CONSUMED_RESET_DURATION: 1, EXEC_EVENLY: true, @@ -40,6 +39,9 @@ const defaults = { INMEMORY_BLOCK_CONSUMED: 200, INMEMEMORY_BLOCK_DURATION: 30, }, + caching: { + CACHE_TYPE: 'redis', + }, security: { KEY: uuidv4(), SECRET: nanoid(32), diff --git a/api/src/services/node-cache.ts b/api/src/services/node-cache.ts index b418c71014..8cf1d33fd9 100644 --- a/api/src/services/node-cache.ts +++ b/api/src/services/node-cache.ts @@ -6,6 +6,7 @@ * checkPeriod is the amount of seconds for the * autodelete to wait before checking * if cache needs to be deleted. + * Have wrapped node cache so we can extend if needed */ import NodeCache from 'node-cache';