From 8cb1214634756df4ddee3f10e4b5b95dc3573f2b Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Tue, 24 Jun 2025 11:40:39 +0100 Subject: [PATCH] fix(api): add a TTL cache env variable --- api/src/config/index.ts | 2 +- docker/.env.example | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/config/index.ts b/api/src/config/index.ts index 2d957807..dad24377 100644 --- a/api/src/config/index.ts +++ b/api/src/config/index.ts @@ -137,7 +137,7 @@ export const config: Config = { }, cache: { type: process.env.REDIS_ENABLED === 'true' ? 'redis' : 'memory', - ttl: 60 * 1000, // Milliseconds + ttl: parseInt(process.env.CACHE_TTL || '3600000'), // Defaulted to 1 hour max: 100, // Maximum number of items in cache (defaults to 100) host: process.env.REDIS_HOST || 'redis', port: parseInt(process.env.REDIS_PORT || '6379'), diff --git a/docker/.env.example b/docker/.env.example index d2941d2d..a9210dbb 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -66,3 +66,6 @@ APP_REDIS_PORT=9001 REDIS_ENABLED=false REDIS_HOST=redis REDIS_PORT=6379 + +# Cache +CACHE_TTL=3600000