Mycache
Mycache is a cache library enhanced front end local cache. Mycache provides two kinds of cache: persist cache and memory cache. Persist cache uses localforage to support.
npm install mycache
How to use Mycache
Init cache
import { Cache, Persist } from 'mycache';
const persist = new Persist();
And the Promise/Async form:
import { Cache, Persist } from 'mycache';
const persist = new Persist();
async function persist() {
await persist.set('key', 'value');
return await persist.get('key');
}
Configuration
Cache Config:
import { Cache } from 'mycache';
const cache = new Cache({
name: 'mycache',
});
Persist Config:
import { Persist } from 'mycache';
const persist = new Persist({
name: 'mycache',
valueMaxLength: 500 * 1000,
storeName: 'persist';
});