|
|
|
|
|
by benologist
4906 days ago
|
|
That's super unnecessary for a single server, you can literally just use a variable outside of your request handling as a cache. var cache;
module.exports = function(request, response) {
if(cache) {
return response.end(cache);
}
// get my data from wherever
cache = the_data;
return response.end(cache);
}
Now 199 out of 200 requests are from memory, there are zero extra moving parts, and you're using a cool part of the language instead of a 3rd party tool you have to select and configure. |
|