From 564b9b55976873d87e669ace916f037b72fe2865 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Mon, 14 Nov 2022 18:26:20 +0300 Subject: refactor(server): redis > ioredis (#5371) * refactor(server): redis > ioredis * refactor(JobQueue): reuse redis connection builder * fix(redisio) * fix(redis): setValue * feat(redis): showFriendlyErrorStack * feat(redis): auto pipelining https://github.com/luin/ioredis/blob/308017a6b9429c16b074e03e70f5524499476fa9/README.md#autopipelining * dont use autopipelining for bullmq * ioredis events --- server/middlewares/cache/shared/api-cache.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/cache/shared/api-cache.ts b/server/middlewares/cache/shared/api-cache.ts index abc919339..9e15bf2d6 100644 --- a/server/middlewares/cache/shared/api-cache.ts +++ b/server/middlewares/cache/shared/api-cache.ts @@ -49,7 +49,7 @@ export class ApiCache { if (!Redis.Instance.isConnected()) return this.makeResponseCacheable(res, next, key, duration) try { - const obj = await redis.hGetAll(key) + const obj = await redis.hgetall(key) if (obj?.response) { return this.sendCachedResponse(req, res, JSON.parse(obj.response), duration) } @@ -100,8 +100,8 @@ export class ApiCache { if (Redis.Instance.isConnected()) { await Promise.all([ - redis.hSet(key, 'response', JSON.stringify(value)), - redis.hSet(key, 'duration', duration + ''), + redis.hset(key, 'response', JSON.stringify(value)), + redis.hset(key, 'duration', duration + ''), redis.expire(key, duration / 1000) ]) } -- cgit v1.2.3