ministore
Installation:
npm install ministore
Usage:
// create our dbvar Store = '../path/to/db/dir' // create some collectionsvar users = var sessions = // will save every 3 secs // sync way (no callback)usersusers // 'doe' // async wayusers
Options:
Store('somestore', options)
polling: true (OR) false (OR) ms [default: false]
Save at intervals
watch: true (OR) false [default: false]
Watch store for changes (if there are many open)
API methods:
All API methods accept a callback as the last argument, making the process async
get(key)
set(key, val)
remove(key)
push(key, val) / unshift(key, val)
shift(key) / pop(key)
has(key)
all()
clear()
list()
length()
forEach(fn)
save()
eval(key)
evalshift(key)
evalpop(key)
Example:
var math = 'mdb''math'mathmath4 5 // 9