Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niklasfi/ueberDB
transforms every database into a object key value store, written in node.js
https://github.com/niklasfi/ueberDB
Last synced: 5 days ago
JSON representation
transforms every database into a object key value store, written in node.js
- Host: GitHub
- URL: https://github.com/niklasfi/ueberDB
- Owner: niklasfi
- License: apache-2.0
- Fork: true (ether/ueberDB)
- Created: 2012-06-23T20:56:56.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-06-23T22:16:39.000Z (over 12 years ago)
- Last Synced: 2024-08-01T12:35:47.932Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 203 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - niklasfi/ueberDB - transforms every database into a object key value store, written in node.js (others)
README
#About
ueberDB is a abstraction layer for databases. It turns every database into a simple key value store, at the moment we only support mysql and sqlite. ueberDB uses a smart cache and buffer algorithm to make databases faster. Reads are cached and writes are done in a bulk. The bulk writing reduces the overhead of a database transaction.
#Install
`npm install ueberDB`
#Example
var ueberDB = require("ueberDB");//mysql
var db = new ueberDB.database("mysql", {"user":"root", host: "localhost", "password":"", database: "store"});
//sqlite in-memory
//var db = new ueberDB.database("sqlite");
//sqlite in file
//var db = new ueberDB.database("sqlite", {filename:"var/sqlite3.db"});
//sqlite in file with a write interval of a half second
//var db = new ueberDB.database("sqlite", {filename:"var/sqlite3.db"}, {writeInterval: 500});//initialize the database
db.init(function (err)
{
if(err)
{
console.error(err);
process.exit(1);
}//set a object as a value
//can be done without a callback, cause the value is immediately in the buffer
db.set("valueA", {a:1,b:2});
//get the object
db.get("valueA", function(err, value){
console.log(value);
db.close(function(){
process.exit(0);
});
});
});#How to add support for another database
Look at sqlite_db.js and mysql_db.js, your module have to provide the same functions. Call it DATABASENAME_db.js and reimplement the functions for your database. If you think it works, test it with `node benchmark.js DATABASENAME`. Benchmark.js is benchmark and test at the same time. It tries to set 100000 values. You can pipe stderr to a file and will create a csv with benchmark results.#License
is Apache v2