Increment leveldb keys
An increment call for levelup.
Why? Because if you're counting up a lot, the gap between a
get and a
for var i = 0; i < 100; i += 1dbget'a-key'val = parseIntval || 0 10val += 1dbput'a-key' val
The above example will probably result in
a-key being set to 1 and staying
level-inc keeps track of overlapping calls like this and handles them
npm install level-inc
require('level-inc')(db)(key, amount, callback)
var db = require'levelup'__dirname + '/db'var inc = require'level-inc'dbvar counter = 0dbinc = incfor var i = 0; i < 200; i += 1dbinc'some-key' 10counter += 1if counter !== 200 returndbget'some-key'// val === "2000"