diff options
Diffstat (limited to 'server/middlewares/cache/cache.ts')
-rw-r--r-- | server/middlewares/cache/cache.ts | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/server/middlewares/cache/cache.ts b/server/middlewares/cache/cache.ts deleted file mode 100644 index 6041c76c3..000000000 --- a/server/middlewares/cache/cache.ts +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | ||
2 | import { ApiCache, APICacheOptions } from './shared' | ||
3 | |||
4 | const defaultOptions: APICacheOptions = { | ||
5 | excludeStatus: [ | ||
6 | HttpStatusCode.FORBIDDEN_403, | ||
7 | HttpStatusCode.NOT_FOUND_404 | ||
8 | ] | ||
9 | } | ||
10 | |||
11 | function cacheRoute (duration: string) { | ||
12 | const instance = new ApiCache(defaultOptions) | ||
13 | |||
14 | return instance.buildMiddleware(duration) | ||
15 | } | ||
16 | |||
17 | function cacheRouteFactory (options: APICacheOptions) { | ||
18 | const instance = new ApiCache({ ...defaultOptions, ...options }) | ||
19 | |||
20 | return { instance, middleware: instance.buildMiddleware.bind(instance) } | ||
21 | } | ||
22 | |||
23 | // --------------------------------------------------------------------------- | ||
24 | |||
25 | function buildPodcastGroupsCache (options: { | ||
26 | channelId: number | ||
27 | }) { | ||
28 | return 'podcast-feed-' + options.channelId | ||
29 | } | ||
30 | |||
31 | // --------------------------------------------------------------------------- | ||
32 | |||
33 | export { | ||
34 | cacheRoute, | ||
35 | cacheRouteFactory, | ||
36 | |||
37 | buildPodcastGroupsCache | ||
38 | } | ||