https://github.com/mikeal/redcouch
A client that stores data in both CouchDB and Redis.
https://github.com/mikeal/redcouch
Last synced: 5 days ago
JSON representation
A client that stores data in both CouchDB and Redis.
- Host: GitHub
- URL: https://github.com/mikeal/redcouch
- Owner: mikeal
- Created: 2012-02-27T20:49:25.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-09-17T21:58:36.000Z (almost 13 years ago)
- Last Synced: 2025-06-27T22:04:37.391Z (5 days ago)
- Language: JavaScript
- Homepage:
- Size: 101 KB
- Stars: 32
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkd
Awesome Lists containing this project
README
# redcouch -- A client that stores data in both CouchDB and Redis.
## Install
npm install redcouchOr from source:
git clone git://github.com/mikeal/redcouch.git
cd redcouch
npm link## Usage
```javascript
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.