aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/cache.ts
diff options
context:
space:
mode:
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