vanillite
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

vanillite

What is it?

tl;dr: localforage + write cache

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?

tl;dr: npm i vanillite

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:

tl;dr: low importance cleanup

Low priority

  1. write more readme on how to set cache settings
  2. add weirdness of instantiation to 100% mirror localforage
  3. test all remaining methods to validate it is compatible with a bare localforage installation
  4. investigate different cache constructions than last in

Buy Me A Coffee

Readme

Keywords

Package Sidebar

Install

npm i vanillite

Weekly Downloads

1

Version

0.1.4

License

MIT

Unpacked Size

7.99 kB

Total Files

4

Last publish

Collaborators

  • one19