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.ts28
1 files changed, 0 insertions, 28 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts
deleted file mode 100644
index e508b22a6..000000000
--- a/server/middlewares/cache.ts
+++ /dev/null
@@ -1,28 +0,0 @@
1import * as apicache from 'apicache'
2import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
3import { Redis } from '../lib/redis'
4
5// Ensure Redis is initialized
6Redis.Instance.init()
7
8const defaultOptions = {
9 redisClient: Redis.Instance.getClient(),
10 appendKey: () => Redis.Instance.getPrefix(),
11 statusCodes: {
12 exclude: [
13 HttpStatusCode.FORBIDDEN_403,
14 HttpStatusCode.NOT_FOUND_404
15 ]
16 }
17}
18
19const cacheRoute = (extraOptions = {}) => apicache.options({
20 ...defaultOptions,
21 ...extraOptions
22}).middleware
23
24// ---------------------------------------------------------------------------
25
26export {
27 cacheRoute
28}