Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ekristen/node-libkv
Standardized KV API for Multiple Key/Value Backends
https://github.com/ekristen/node-libkv
Last synced: 2 days ago
JSON representation
Standardized KV API for Multiple Key/Value Backends
- Host: GitHub
- URL: https://github.com/ekristen/node-libkv
- Owner: ekristen
- License: mit
- Created: 2015-09-16T03:57:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-17T15:21:04.000Z (over 7 years ago)
- Last Synced: 2025-01-13T07:46:54.502Z (5 days ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
**WIP:** This is alpha/beta, tests pass, basic functionality is there, things most likely will change. Until the library hits v1.0.0, all bets are off on backwards compatibility.
[![Dependency Status](https://david-dm.org/ekristen/node-libkv.svg)](https://david-dm.org/ekristen/node-libkv) [![devDependency Status](https://david-dm.org/ekristen/node-libkv/dev-status.svg)](https://david-dm.org/ekristen/node-libkv#info=devDependencies) [![Build Status](https://travis-ci.org/ekristen/node-libkv.svg)](https://travis-ci.org/ekristen/node-libkv) ![License](https://img.shields.io/badge/license-MIT-blue.svg) ![Downloads per Month](https://img.shields.io/npm/dm/libkv.svg) ![Downloads](https://img.shields.io/npm/dt/libkv.svg)
# node-libkvProvides a standardized API for multiple key/value storage backends. Inspired by https://github.com/docker/libkv. It is **not** designed to cover all implementations and use cases.
Consul, etcd, and Zookeeper all require path (or folder like) structures, therefore the library has been designed to normalize all keys to be based on path (aka separated by `/`).
Consul, redis, and LevelDB strip the `/` from the beginning of the key, but it is required for etcd and Zookeeper.
## Installation
`npm install libkv`
## Supported Backends
* Consul
* etcd
* LevelDB
* Redis
* Zookeeper## API
* get
* set (alias: put)
* delete (aliases: remove, del)
* existsThe below definitions are general, they vary slightly by backend.
### .get(key, [options], [callback])
### .set(key, value = null, [options], [callback])
* ttl (in seconds) (redis, etcd, leveldb, consul)
* maxRetries (etcd)### .delete(key, [callback])
### .watch(key, [options], [callback])
**Note:** Not yet implemented
## Usage
```javascript
var libkv = require('libkv')var client = libkv('redis', {
uri: 'redis://172.15.5.5:6379'
})client.set('example', 'value', function(err, ok) {
// ok == true/false
})```
## Testing
`npm test` or `npm test ` (example: `npm test redis`)
## Badges
[![Dependency Status](https://david-dm.org/ekristen/node-libkv.svg)](https://david-dm.org/ekristen/node-libkv)