0.1.7 • Published 3 years ago

goodcache v0.1.7

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

GoodCache

A fifo based cache for Node and browser, uses the GoodCore library.

Usage

Install from npm.

Simple example

const fifo = new Cache<string>();
fifo.push("in fifo", "data");
fifo.hit("in fifo");

Simple caching of a class function

const test = new TestClass();
fifo.cache(test, "TestFn");
test.TestFn("test"); // returns some value
test.TestFn("test"); // returns cached value

Advanced caching of a class function

const test = new TestClass();
fifo.cache(test, "TestFn", (...args) => { return "some key string depending on the args"; } );
test.TestFn("test"); // returns some value
test.TestFn("test"); // returns cached value if the key function returns the same

For more look at the tests.

0.1.7

3 years ago

0.1.6

3 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago