vanillite
v0.1.4
Published
vanillite
Downloads
14
Readme
vanillite
What is it?
Vanillite is a wrapper around localforage. It seeks to leave the main-used functionality unused. It, unlike localforage, wants to move lightning-fast.
the default cache option allows for storing 1000 items in memory at a time, always the latest things stored. It also makes writes drop out of time, so you don't have to wait to get your item back. This improves performance alot. Against a stubbed lib that is even faster than localforage, it was beating it by about 2->4 orders of magnitude. most "writes" happened in less than 0.5ms.
How to use it?
import it and use it, just like localforage!
import Vanillite from 'vanillite';
const fastStore = new Vanillite({ name: 'cards' });
const item = await fastStore.setItem(nanoId(), { some: 'stuff' });
const allItemIds = await fastStore.keys();
TODO:
Low priority
- write more readme on how to set cache settings
- add weirdness of instantiation to 100% mirror localforage
- test all remaining methods to validate it is compatible with a bare localforage installation
- investigate different cache constructions than
last in