From ae603362e99e275b85ff055a238cc0685eea4978 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 28 Nov 2021 17:05:50 +0100 Subject: [PATCH] back/redis: fix not using redis.prefix config --- src/components/RedisComponent.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/RedisComponent.ts b/src/components/RedisComponent.ts index 9ceb9e9..d31953f 100644 --- a/src/components/RedisComponent.ts +++ b/src/components/RedisComponent.ts @@ -8,6 +8,7 @@ import CacheProvider from "../CacheProvider.js"; import {logger} from "../Logger.js"; export default class RedisComponent extends ApplicationComponent implements CacheProvider { + private readonly prefix: string = config.get('redis.prefix'); private redisClient?: RedisClient; private store: Store = new RedisStore(this); @@ -42,7 +43,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach return; } - this.redisClient.get(key, (err, val) => { + this.redisClient.get(this.prefix + key, (err, val) => { if (err) { reject(err); return; @@ -63,7 +64,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach return; } - this.redisClient.del(key, (err) => { + this.redisClient.del(this.prefix + key, (err) => { if (err) { reject(err); return; @@ -81,7 +82,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach return; } - this.redisClient.psetex(key, ttl, value, (err) => { + this.redisClient.psetex(this.prefix + key, ttl, value, (err) => { if (err) return reject(err); resolve(); }); @@ -95,7 +96,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach return; } - this.redisClient.pexpire(key, ttl, (err) => { + this.redisClient.pexpire(this.prefix + key, ttl, (err) => { if (err) return reject(err); resolve(); });