@brushy/storage provides a NodeCache-style API that runs in Node, the browser, and SSR contexts. Optional persist adapters write to localStorage or sessionStorage, and a built-in invalidation bus keeps tabs in sync when instances share the same id.
React bindings live in @brushy/storage-react (separate package).
Install
Quick example
Documentation
Getting started
- Getting started: install and first instance
- Configuration: all
StorageOptions - API reference: every
Storagemethod
Features
- TTL: duration parsing and expiry
- Events:
on/offand React subscriptions - Persist adapters: local, session, custom
SyncPersist - Cache bus: cross-tab and custom invalidation
- Errors:
StorageErrorcodes - Node vs browser: SSR, registry, runtime matrix
React & migration
- React hooks:
StorageProvider,useStorage - Migration from @brushy/localstorage: v1 → v2