How to use memory cache in Node.js?

One of the best ways to improve application performance is to configure the caching on the server. Let’s use the memory-cache plugin and we will configure the cache on Node.js server.

First, we need to install the memory-cache plugin and save it to the Node.js application.
npm install memory-cache --save

Then we can simply configure the plugin and test the set and get the cache values as below.
var cache = require('memory-cache');

cache.put('key', 'value');

That’s it. I hope this will help. 🙂

One Reply to “How to use memory cache in Node.js?”

Leave a Reply

Your email address will not be published. Required fields are marked *