1.1.0 • Published 6 years ago

lru-cache-memoize v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

LRU Memoize

import memoize from 'lru-cache-memoize';

const add = num => console.log(num) || num+1;
const memoAdd = memoize(add, {max: 2});
memoAdd(1); // Cache Miss (with logging 1)
memoAdd(1); // Cache Hit
memoAdd(2); // Cache Miss (with logging 2)
memoAdd(2); // Cache Hit
memoAdd(1); // Cache Hit
memoAdd(3); // Cache Miss (with logging 3)
memoAdd(1); // Cache Hit
memoAdd(2); // Cache Miss (with logging 2)

Inspired By

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago