Storing and structuring your application data on JavaScript.
Providing a standard Store Interface and Redis-copy API that you can use in wherever.
Loading via script tag:
<script style="text/javascript" src="/path/to/script/min.js">
With node previously installed:
$ npm install min
If you using SeaJS, you can install with spm:
$ spm install iwillwen/min
If you are using component, you can install it with:
$ component install iwillwen/mindb
Or bower?:
$ bower install mindb
Common key-value via such as SET, GET, etc.
min.set('foo', 'bar', function(err) {
if (err) {
return console.error(err);
}
min.get('foo', function(err, value) {
if (err) {
return console.error(err);
}
console.log(value); //=> bar
});
});
setSet the value of a key(key, value[, callback])setnxSet the value of a key, only if the key does not exist(key, value[, callback])setexSet the value and expiration of a key(key, seconds, value[, callback])psetexSet the value and expiration in milliseconds of a key(key, millseconds, value[, callback])msetSet multiple keys to multiple values(plainObject[, callback])msetnxSet multiple keys to multiple values, only if none of the keys exist(plainObject[, callback])appendAppend a value to a key(key, value[, callback])getGet the value of a key(key[, callback])mgetGet the values of a set of keys(keys[, callback])getsetSet the value of a key and return its old value(key, value[, callback])strlenGet the length of a key(key[, callback])incrIncrement the integer value of a key by one(key[, callback])incrbyIncrement the integer value of a key by the given amount(key, increment[, callback])incrbyfloatIncrement the float value of a key by the given amount(key, increment[, callback])
Maybe you can get the way by browsing Redis Commands. XD
Nested Callbacks? Maybe you would prefer Promise:
min.incr('user_id')
.then(function(curr) {
return min.hmset('user-' + curr, {
name: 'Will Wen Gunn',
id: 'iwillwen',
email: 'willwengunn@gmail.com'
});
})
.then(function(key) {
var id = key.substr(5);
return min.sadd('user-msg-' + id, 'WelCome!');
})
.then(function(length) {
// ...
})
.fail(function(err) {
console.log(err);
});
Anymore else? How about MULTI?
min.multi()
.incr('msg-seq')
.incr('msg-seq')
.incr('msg-seq')
.exec(function(err, results) {
if (err) {
return console.error(err);
}
console.log(results); //=> [ [ 1 ], [ 2 ], [ 3 ] ]
});
Support multiple databases:
var Min = min.fork();
Min.set('foo', 'bar')
.then(/*...*/)
.fail(/*...*/);
Read the Store Interface Documentation.
Contribution is welcome.There are more than one way to contribute, and I will appreciate any way you choose.
- tell your friends about iwillwen/mindb, let MinDB to be known
- discuss MinDB, and submit bugs with github issues
- send patch with github pull request
- donate MinDB
We recommend you to use git-flow to make a patch.
Hint:
$ git flow feature start [featurename]
$ git add .
$ git commit -m 'new feature description'
$ git flow feature finish [featurename]
Copyright (c) 2012-2013 Will Wen Gunn(willwengunn@gmail.com) All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

