1 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
2 import { ApiCache, APICacheOptions } from './shared'
4 const defaultOptions: APICacheOptions = {
6 HttpStatusCode.FORBIDDEN_403,
7 HttpStatusCode.NOT_FOUND_404
11 function cacheRoute (duration: string) {
12 const instance = new ApiCache(defaultOptions)
14 return instance.buildMiddleware(duration)
17 function cacheRouteFactory (options: APICacheOptions) {
18 const instance = new ApiCache({ ...defaultOptions, ...options })
20 return { instance, middleware: instance.buildMiddleware.bind(instance) }
23 // ---------------------------------------------------------------------------
25 function buildPodcastGroupsCache (options: {
28 return 'podcast-feed-' + options.channelId
31 // ---------------------------------------------------------------------------
37 buildPodcastGroupsCache