aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/redis.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/redis.ts')
-rw-r--r--server/lib/redis.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/server/lib/redis.ts b/server/lib/redis.ts
index 06a340060..e547537c3 100644
--- a/server/lib/redis.ts
+++ b/server/lib/redis.ts
@@ -6,8 +6,8 @@ import { CONFIG, USER_PASSWORD_RESET_LIFETIME, VIDEO_VIEW_LIFETIME } from '../in
6 6
7type CachedRoute = { 7type CachedRoute = {
8 body: string, 8 body: string,
9 contentType?: string 9 contentType: string
10 statusCode?: string 10 statusCode: string
11} 11}
12 12
13class Redis { 13class Redis {
@@ -75,11 +75,12 @@ class Redis {
75 } 75 }
76 76
77 setCachedRoute (req: express.Request, body: any, lifetime: number, contentType?: string, statusCode?: number) { 77 setCachedRoute (req: express.Request, body: any, lifetime: number, contentType?: string, statusCode?: number) {
78 const cached: CachedRoute = { 78 const cached: CachedRoute = Object.assign({}, {
79 body: body.toString(), 79 body: body.toString()
80 contentType, 80 },
81 statusCode: statusCode.toString() 81 (contentType) ? { contentType } : null,
82 } 82 (statusCode) ? { statusCode: statusCode.toString() } : null
83 )
83 84
84 return this.setObject(this.buildCachedRouteKey(req), cached, lifetime) 85 return this.setObject(this.buildCachedRouteKey(req), cached, lifetime)
85 } 86 }