diff --git a/sample.env b/sample.env index 02ef06c9c6..71b11fbfca 100644 --- a/sample.env +++ b/sample.env @@ -9,3 +9,4 @@ REDIS_PORT = 6379 REDIS_PASSWORD = 123 REDIS_USERNAME = abc USE_REDIS_DB = true +REDIS_EXPIRY_TIME_IN_SEC = 3600 \ No newline at end of file diff --git a/src/util/redis/redisConnector.js b/src/util/redis/redisConnector.js index 5a61e683b6..749e23ff83 100644 --- a/src/util/redis/redisConnector.js +++ b/src/util/redis/redisConnector.js @@ -32,7 +32,7 @@ const RedisDB = { log.error(`Redis is down at ${this.host}:${this.port}`); return false; // stop retrying }, - tls: {} + tls: {}, }); this.client.on('ready', () => { log.info(`Connected to redis at ${this.host}:${this.port}`); @@ -102,7 +102,7 @@ const RedisDB = { * @param {*} isValJson set to false if value is not a json object * */ - async setVal(key, value, expiryTimeInSec = 60 * 60) { + async setVal(key, value, expiryTimeInSec = process.env.REDIS_EXPIRY_TIME_IN_SEC || 3600) { try { await this.checkAndConnectConnection(); // check if redis is connected and if not, connect if (typeof value === 'object') {