node-stream-cache

0.0.4 • Public • Published

node-stream-cache

Stream things in and out of a redis cache

Example

var Cache = require('./index.js')
  , cacher = new Cache
  , request = require('request')
  , JSONStream = require('JSONStream')
  , es = require('event-stream')

var work = function () {
  var parser = JSONStream.parse(['rows', true])
    , req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'})

  req.pipe(parser)
  return parser
}

var done = function (stream) {
  stream.pipe(es.mapSync(function (data) {
                console.error(data)
                return data
              }))
}

cacher.process('docs', work, done, 60)

Readme

Keywords

none

Package Sidebar

Install

npm i node-stream-cache

Weekly Downloads

1

Version

0.0.4

License

BSD

Last publish

Collaborators

  • koopa