diff options
Diffstat (limited to 'server/middlewares/cache.ts')
-rw-r--r-- | server/middlewares/cache.ts | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts deleted file mode 100644 index 0708ee8e8..000000000 --- a/server/middlewares/cache.ts +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | import { Redis } from '../lib/redis' | ||
2 | import * as apicache from 'apicache' | ||
3 | import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes' | ||
4 | |||
5 | // Ensure Redis is initialized | ||
6 | Redis.Instance.init() | ||
7 | |||
8 | const 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 | |||
19 | const cacheRoute = (extraOptions = {}) => apicache.options({ | ||
20 | ...defaultOptions, | ||
21 | ...extraOptions | ||
22 | }).middleware | ||
23 | |||
24 | // --------------------------------------------------------------------------- | ||
25 | |||
26 | export { | ||
27 | cacheRoute | ||
28 | } | ||