- res.send = (body) => {
- if (res.statusCode >= 200 && res.statusCode < 400) {
- const contentType = res.get('content-type')
- Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode)
- .then(() => done())
- .catch(err => {
- logger.error('Cannot cache route.', { err })
- return done(err)
- })
+ res.send = (body) => {
+ if (res.statusCode >= 200 && res.statusCode < 400) {
+ const contentType = res.get('content-type')
+ const lifetime = parseDuration(lifetimeArg)
+
+ Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode)
+ .then(() => done())
+ .catch(err => {
+ logger.error('Cannot cache route.', { err })
+ return done(err)
+ })
+ }
+
+ return sendSave(body)