1.0.1 • Published 4 years ago

auto-fill-lru v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

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