redis-streams
Extends the official node_redis client with additional functionality to support streaming data into and out of Redis avoiding buffering the entire contents in memory. The real work is powered by the redis-rstream and redis-wstream by @jeffbski.
Installation
npm install redis-streams
Usage
var redis = ;redis;
This will extend the RedisClient
prototype with two additional functions:
readStream(key)
- get a Readable stream from redis.
writeStream(key, maxAge)
- get a Writable stream from redis.
writeThrough(key, maxAge)
- write to redis and pass the stream through.
var redis = ;redis; var redisClient = redis; redisClient ; fs ; fs ;
See the unit tests for additional usage examples.
Caching Proxy
You could also implement a Connect caching proxy middleware.
var redis = ;var request = ;redis; var redisClient = redis; app;
The express-api-proxy module utilizes redis-streams
for this purpose, but in a more advanced way.