as-store
v2.1.0
Published
Asynchronous localStorage for web app.
Maintainers
Readme
Asynchronous local storage (Write through cache)
A local storage wrapper, that helps to write data to disk asynchronously. It uses in-mem cache for faster "READ"
Install
npm install as-store
Usage
Methods:
AsStore.setItem(key, value)- setvalueforkeyinas-storeAsStore.getItem(key)- lookup data forkeyfromas-storeAsStore.removeItem(key)- removekeyfromas-storeAsStore.flush()- flush all the data fromas-storeAsStore.onWriteComplete(function)- attach handler to disk "WRITE".funcitonwill be called when writing to disk.
Why it's fast and non-blocking ?
setItem - doesn't write the data to disk immediately. Non-blocking. Process multiple write operation at once (with 500ms throttling).getItem - doesn't read data from disk. It maintain a hash map in client. It directly returns data from memory.
