back/redis: fix not using redis.prefix config
This commit is contained in:
parent
be0676611a
commit
ae603362e9
@ -8,6 +8,7 @@ import CacheProvider from "../CacheProvider.js";
|
|||||||
import {logger} from "../Logger.js";
|
import {logger} from "../Logger.js";
|
||||||
|
|
||||||
export default class RedisComponent extends ApplicationComponent implements CacheProvider {
|
export default class RedisComponent extends ApplicationComponent implements CacheProvider {
|
||||||
|
private readonly prefix: string = config.get('redis.prefix');
|
||||||
private redisClient?: RedisClient;
|
private redisClient?: RedisClient;
|
||||||
private store: Store = new RedisStore(this);
|
private store: Store = new RedisStore(this);
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.redisClient.get(key, (err, val) => {
|
this.redisClient.get(this.prefix + key, (err, val) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
@ -63,7 +64,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.redisClient.del(key, (err) => {
|
this.redisClient.del(this.prefix + key, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
@ -81,7 +82,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.redisClient.psetex(key, ttl, value, (err) => {
|
this.redisClient.psetex(this.prefix + key, ttl, value, (err) => {
|
||||||
if (err) return reject(err);
|
if (err) return reject(err);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
@ -95,7 +96,7 @@ export default class RedisComponent extends ApplicationComponent implements Cach
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.redisClient.pexpire(key, ttl, (err) => {
|
this.redisClient.pexpire(this.prefix + key, ttl, (err) => {
|
||||||
if (err) return reject(err);
|
if (err) return reject(err);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user