aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/cache.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-01-09 16:51:51 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-01-10 10:14:04 +0100
commitf2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6 (patch)
tree2786e879b381bd637ebaaf84f7fa7f1ad08d8279 /server/middlewares/cache.ts
parent9270ccf6dca5b2955ad126947d4296deb385fdcb (diff)
downloadPeerTube-f2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6.tar.gz
PeerTube-f2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6.tar.zst
PeerTube-f2f0eda543ab54eec0f6bcdd8ccf6e382d5cafb6.zip
Adapt feeds content-type to accept header
Diffstat (limited to 'server/middlewares/cache.ts')
-rw-r--r--server/middlewares/cache.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts
index ef8611875..cb24d9e0e 100644
--- a/server/middlewares/cache.ts
+++ b/server/middlewares/cache.ts
@@ -4,12 +4,18 @@ import * as apicache from 'apicache'
4// Ensure Redis is initialized 4// Ensure Redis is initialized
5Redis.Instance.init() 5Redis.Instance.init()
6 6
7const options = { 7const defaultOptions = {
8 redisClient: Redis.Instance.getClient(), 8 redisClient: Redis.Instance.getClient(),
9 appendKey: () => Redis.Instance.getPrefix() 9 appendKey: () => Redis.Instance.getPrefix(),
10 statusCodes: {
11 exclude: [ 404, 403 ]
12 }
10} 13}
11 14
12const cacheRoute = apicache.options(options).middleware 15const cacheRoute = (extraOptions = {}) => apicache.options({
16 ...defaultOptions,
17 ...extraOptions
18}).middleware
13 19
14// --------------------------------------------------------------------------- 20// ---------------------------------------------------------------------------
15 21