npm.io
1.0.1 • Published 6 years ago

auto-fill-lru

Licence
MIT
Version
1.0.1
Deps
1
Size
18 kB
Vulns
0
Weekly
0

auto-fill-lru

A LRU cache with a provider function to auto-cache itens

Build CI

Installing

npm install auto-fill-lru

Examples


function slowFunction(key) {
  return new Promise((resolve) => {
    setTimeout(() => resolve(100), 1000);
  });
}

const instance = new LRU({
  retrieveFunction: slowFunction,
});

result = await intance.get('1'); // return after 1s

result2 = await instance.get('1'); // return imediatly