aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/cache
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2022-11-14 18:26:20 +0300
committerGitHub <noreply@github.com>2022-11-14 16:26:20 +0100
commit564b9b55976873d87e669ace916f037b72fe2865 (patch)
tree8c3c097cf3a34766e60fa1bdcf1de7d8558eff8c /server/middlewares/cache
parentff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1 (diff)
downloadPeerTube-564b9b55976873d87e669ace916f037b72fe2865.tar.gz
PeerTube-564b9b55976873d87e669ace916f037b72fe2865.tar.zst
PeerTube-564b9b55976873d87e669ace916f037b72fe2865.zip
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
Diffstat (limited to 'server/middlewares/cache')
-rw-r--r--server/middlewares/cache/shared/api-cache.ts6
1 files changed, 3 insertions, 3 deletions
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 {
49 if (!Redis.Instance.isConnected()) return this.makeResponseCacheable(res, next, key, duration) 49 if (!Redis.Instance.isConnected()) return this.makeResponseCacheable(res, next, key, duration)
50 50
51 try { 51 try {
52 const obj = await redis.hGetAll(key) 52 const obj = await redis.hgetall(key)
53 if (obj?.response) { 53 if (obj?.response) {
54 return this.sendCachedResponse(req, res, JSON.parse(obj.response), duration) 54 return this.sendCachedResponse(req, res, JSON.parse(obj.response), duration)
55 } 55 }
@@ -100,8 +100,8 @@ export class ApiCache {
100 100
101 if (Redis.Instance.isConnected()) { 101 if (Redis.Instance.isConnected()) {
102 await Promise.all([ 102 await Promise.all([
103 redis.hSet(key, 'response', JSON.stringify(value)), 103 redis.hset(key, 'response', JSON.stringify(value)),
104 redis.hSet(key, 'duration', duration + ''), 104 redis.hset(key, 'duration', duration + ''),
105 redis.expire(key, duration / 1000) 105 redis.expire(key, duration / 1000)
106 ]) 106 ])
107 } 107 }