A dead simple, in memory, somewhat-recently-used cache.
O(1) insertion, retrieval and deletion.
If you can, don't use this library. Use an ESNext WeakMap instead.
function cubed (x) {
return x * x * x
}
let sru = require('sru')
let cache = sru(100)
console.log(cache(8, cubed), 512)
console.log(cache(8, cubed), 512) // cubed was not called this time