A NodeJS package to simplify in-memory caching.
npm install fwd/cache
const cache = require('@fwd/cache')
// store something in-memory
cache('my_unique_key', 'my value')
// get that something
var my_unique_key = cache('my_unique_key')
console.log(my_unique_key) // my value
// you may also pass an expiration delay as a third parameter
cache('my_unique_key', 'my value', 10000) // 10 seconds in ms
// wait 10 seconds
setTimeout(() => {
cache('my_unique_key') // undefined
}, 10000) // 10 seconds in ms
Contributions, issues and feature requests are welcome! Feel free to check issues page.
Give a star if this project helped you.
MIT License (No Commercial Restrictions.)
Copyright © @nano2dev.