0.0.1 • Published 12 years ago

redriak v0.0.1

Weekly downloads
8
License
-
Repository
github
Last release
12 years ago

redriak -- A client that stores data in both Riak and Redis.

Install

Or from source:

Usage

var redriak = require('redriak')
  , red = redriak({
    host: 127.0.0.1 // default value
    , port: 8098 // default value
    , bucket: 'redis' // must be set
  })
  ;
  
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(riakoptions,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 redriak = require('redriak')
  , red = redriak({
    bucket: 'redis'
  })
  ;
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.riak

Couch client, uses @frank06's riak library.