Socket
Book a DemoInstallSign in
Socket

redcouch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redcouch

A client that stores data in both CouchDB and Redis.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

redcouch -- A client that stores data in both CouchDB and Redis.

Install

  npm install redcouch

Or from source:

  git clone git://github.com/mikeal/redcouch.git 
  cd redcouch
  npm link

Usage

var redcouch = require('redcouch')
  , red = redcouch('http://localhost:5984/shortened')
  ;
  
red.set('key', 'value', function (e) {
  if (e) throw e
  red.get('key', function (e, value) {
    if (e) throw e
    console.error(value) // "value"
    red.close()
  })
})

redcouch(couchurl,[redisoptions])

By default redcouch will connect to a localhost Redis on the default port.

Available Redis options are: host, port, and select. The select option will insure that redcouch uses the specified numeric DB.

red.prime([clobber], cb)

Fills the Redis database with all the key/value pairs from the Couch database.

var redcouch = require('redcouch')
  , red = redcouch('http://localhost:5984/shortened')
  ;
red.prime(function (e) {
  if (e) throw e
  console.log('finished')
  red.close()
})

Clobber will remove all Redis keys that are not in the Couch database.

red.close()

Must be called in order to shutdown the redis connections as they are persistent.

red.ensureWrite = false

Defaults to false. When set to false set callbacks will be resolved after the key is stored in Redis, if set to true they will not be resolved until they are set in Couch.

red.redis

Redis client, uses @mranney's wonderful node-redis library.

red.couch

Couch client, uses @mikeal's couch library.

FAQs

Package last updated on 17 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts