I have a api export with a lot of data so I tried to used the node-cache so the api will be faster since take more than 2 min to get the data, I am new on this so I found the follow code: Notes: env node js/express
JavaScript
x
9
1
const NodeCache = require("node-cache");
2
const axios = require('axios');
3
const myCache = new NodeCache({stdTTL:100000})
4
axios.get('http://localhost:5000/test/example)
5
.then(function (response) {
6
console.log(response)
7
myCache.set("exampleCache",response,10000);
8
res.send(response)
9
Any suggestion or recommend will be great!
Advertisement
Answer
The solution was using a buffer but since we had to many data, the increase the memory from the db was the solution