npm install --save cache-manager-web
import CreateCache from 'cache-manager-web'
const Cache = CreateCache({
store: 'memory',
max: 100,
ttl: 5 * 1000
})
const getMockDate = () => new Promise((resolve, reject) => {
setTimeout(() => {
resolve({ success: true })
}, 500)
})
const init = async () => {
const key = 'test'
const data = await Cache.wrap(key, getMockDate)
}
init()
See the Cache-Manager-Web-Example to see use chche-manage-web
in your applications.
- Improve README.md documentation
- 100% test coverage via mocha, nyc
cache-manager-web is licensed under the MIT license.