Closed carvalhoviniciusluiz closed 6 years ago
@carvalhoviniciusluiz it looks like you are trying to use this for express caching? I created a test using the code below so and it seems to be working so maybe try that with the latest version of the module.
// This works fine using the latest "expeditious" module
const instance = expeditious({
engine: require('expeditious-engine-memory')(),
defaultTtl: 120 * 1000,
namespace: 'hello'
})
To fix the warning in your own code try this:
var expressCache = require('express-expeditious')({
namespace: 'expresscache',
// Changed "expeditious" to "engine"
engine: cache,
statusCodeExpires: {
500: (30 * 1000),
502: (60 * 1000)
},
defaultTtl: '2 minute'
})
Here's the fastest way to setup some express caching - you can remove some of the extra code you have since it's no longer required. It will print a warning, but you can ignore it if your application is not going to be deployed to a large user base.
const app = require('express')()
const cache = require('express-expeditious')({
defaultTtl: 120 * 1000,
namespace: 'testing'
})
app.use(cache)
app.get('/', (req, res, next) => {
setTimeout(() => {
res.end('ok')
}, 2000)
})
app.listen(3000, (err) => {
if (err) throw err;
console.log('listening on 3000')
})
Let me know if this helps.
@carvalhoviniciusluiz closing this since I cannot replicate in latest versions. Reopen if necessary.
Hello I'm trying to use the expeditious. She's asking for opts.defaultTtl Follows an image..
How can I solve this? To try to solve I passed the keys to the express-expeditious this way
then the following message appears in the terminal
I do not know how to solve :{