-
-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Labels
Description
Hi, I'm trying to memoize a function to the point where there is no cache, but concurrent execution also doesn't happen. To do this max: 0
should work to disable cache, but in practice it doesn't. Example:
import memoizee from 'memoizee';
import {sleep} from "../lib/util.js";
const x = async (s: string) => {
await sleep(500);
console.log(`Running ${s}`);
}
const m = memoizee(x, {max: 0, primitive: true});
await m('TEST');
await m('TEST');
await m('TEST 2');
await m('TEST');
In this case output is
Running TEST
Running TEST 2
Meaning the values are memoized. Setting max
to 1 works properly, as do higher values.