This is a LevelDOWN API compatible Aerospike adapter for LevelUP.
For more information about Level, see:
npm install aerospike-leveldown --save
'use strict';
let AerospikeLevelDOWN = require('aerospike-leveldown');
let levelup = require('levelup');
let db = levelup('/who/cares/', {
db: function (location) {
return new AerospikeLevelDOWN(location)
},
address: '127.0.0.1',
port: 3000
});
// Namespace and set will be needed on every database operation
// It indicates where to save data and where to retrieve data from
let namespace_and_set = {
namespace: 'test',
set: 'anything'
};
// Save value bar with key foo in defined namespace and set
db.put('foo', 'bar', namespace_and_set, function (err) {
if (err) throw err;
// Get value from key foo in defined namespace and set
db.get('foo', namespace_and_set, function (err, result) {
if (err) throw err;
console.log('Got foo =', result.value)
// Delete key foo and its value in defined namespace and set
db.del('foo', namespace_and_set, function (err) {
if (err) throw err;
})
})
});
MIT License © siroop AG