Cache AP video route for 5 seconds

This commit is contained in:
Chocobozzz 2018-05-11 09:44:04 +02:00
parent 8a2db2e8cb
commit fd4484f19e
No known key found for this signature in database
GPG key ID: 583A612D890159BE
5 changed files with 42 additions and 30 deletions

View file

@ -1,5 +1,5 @@
import * as express from 'express'
import { CONFIG, FEEDS } from '../initializers/constants'
import { CONFIG, FEEDS, ROUTE_CACHE_LIFETIME } from '../initializers/constants'
import { asyncMiddleware, feedsValidator, setDefaultSort, videosSortValidator } from '../middlewares'
import { VideoModel } from '../models/video/video'
import * as Feed from 'pfeed'
@ -12,8 +12,8 @@ const feedsRouter = express.Router()
feedsRouter.get('/feeds/videos.:format',
videosSortValidator,
setDefaultSort,
asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.FEEDS)),
asyncMiddleware(feedsValidator),
asyncMiddleware(cacheRoute),
asyncMiddleware(generateFeed)
)