@turist/promise-cache
v0.0.2
Published
Cache and dedup async function calls using the arguments as an n-tuple cache key
Downloads
2,929
Readme
promise-cache
Easily convert time to milliseconds
Examples
import promiseCache from "@turist/promise-cache"
const LRU = require('lru-cache')
const ms = require('ms')
const cache = new LRU({
max: 100,
maxAge: ms('5s')
})
const getData = promiseCache(cache, async (args1, args2) => {
// ... do async stuff
return something;
})