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"
npm install as-store
AsStore.setItem(key, value)- set
AsStore.getItem(key)- lookup data for
AsStore.flush()- flush all the data from
AsStore.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.