keys

0.1.2 • Public • Published

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

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

Readme

Keywords

none

Package Sidebar

Install

npm i keys

Weekly Downloads

784

Version

0.1.2

License

none

Last publish

Collaborators

  • tjholowaychuk