fix: lib lefuturiste/express-redis-middleware

This commit is contained in:
Matthieu Bessat 2022-09-05 15:40:11 +02:00
parent 83f4aed5ea
commit 6ea2019b8f
5 changed files with 10181 additions and 7267 deletions

View file

@ -45,12 +45,9 @@ const cacheDuration = {
page: 3600 * 8
}
let cache: any = {
route: (x = null, y = null) => {
return (req: any, res: any, next: any) => { }
}
}
let cache: any
if (process.env.DISABLE_CACHE === 'true') {
console.log("> App: redis caching is disabled")
cache = {
route: (x = null, y = null) => {
return (req: any, res: any, next: any) => {
@ -59,7 +56,9 @@ if (process.env.DISABLE_CACHE === 'true') {
}
}
} else {
cache = ExpressRedisCache({
console.log("> App: redis caching is enabled")
// I won't go further with this, I will just use any for now...
cache = new (ExpressRedisCache as any)({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
auth_pass: process.env.REDIS_PASSWORD,

View file

@ -26,4 +26,4 @@ export default class ErrorController {
static internalError(req: express.Request, res: express.Response) {
console.log(res.locals.blabla.blabla)
}
}
}