It appears that if I require(memoizee/weak), then it does not respect maxAge option. The following program prints the same value all over:
const Promise = require('bluebird')
const memoize = require('memoizee/weak');
let thing = {}
let count = 0;
async function whatever(thing) {
await Promise.delay(500)
return count++;
}
const memoized = memoize(whatever, {
promise: true,
primitive: true,
maxAge: 1
})
async function test() {
for (let i = 0; i < 10; ++i) {
console.log(memoized(thing))
await Promise.delay(1000)
}
}
test().then(() => console.log(done), (err) => console.log(err))
If I add
require('memoizee/ext/max-age')
``
then it works as expected. It looks that the default non-weak case requires all extensions internally, while the weak one does not.
It appears that if I
require(memoizee/weak)
, then it does not respectmaxAge
option. The following program prints the same value all over:If I add