Unified interface for node key/value store clients -- memory, nStore, Redis, Riak
JavaScript
Pull request Compare This branch is 15 commits ahead, 5 commits behind frank06:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
lib
support
test
.gitignore
.gitmodules
History.md
Makefile
Readme.md
index.html
index.js
package.json

Readme.md

Keys

Unified interface for node key/value stores.

Supported Stores

Currently the following stores are supported:

  • Memory -- no dependency
  • nStore -- requires nstore (npm install nstore)
  • Redis -- requires node_redis (npm instasll redis)
  • Riak -- requires upcoming version 0.3.0 of riak-js
  • Mongo -- requires node-mongodb-native

Stores that specify "requires MODULE" must have the MODULE available to require().

Installation

$ npm install keys

API

The following is the current API that each store must comply to:

Store#get(key, callback)

Fetches the given key and callback(err, buf).

Store#set(key, val[, callback])

Sets key to val and callback(err).

Store#remove(key[, callback])

Removes key and callback(err).

Store#has(key, callback)

Checks if key exists and callback(err, exists).

Store#length(callback)

Fetches the number of keys stored and callback(err, len).

Store#clear([callback])

Clears the store and callback(err).

Testing

Run all tests:

$ make test

Run specific test(s):

$ make test TESTS=test/memory.test.js

Setup to run all tests:

$ npm install riak-js
$ redis-server &
$ riak start