Skip to content

Instantly share code, notes, and snippets.

@bhague1281
Last active July 27, 2016 18:39
Show Gist options
  • Save bhague1281/fe24346dd5a33099933f65653b0875f5 to your computer and use it in GitHub Desktop.
Save bhague1281/fe24346dd5a33099933f65653b0875f5 to your computer and use it in GitHub Desktop.
const NodeCache = require('node-cache');
const cache = new NodeCache();
let data = { results: [] };
// using the cache module to add an object to the cache
cache.set('my-pokemon', data, (err, success) => {
// success will be true if successful
});
// using the cache module to retrieve an object from the cache
cache.get('my-pokemon', (err, data) => {
// data will be the object from the cache, if it exists
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment