Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

npm module to easily connect to the "redis to go" facilities in heroku (https://addons.heroku.com/redistogo)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.md

heroku-redis-client

Build Status

npm module to easily connect to the "redis to go" facilities in heroku (https://addons.heroku.com/redistogo)

Installation

npm install heroku-redis-client

Usage

Using redis as your session store

var connect = require('connect'),
    RedisStore = require('connect-redis')(connect),
    redis = require('heroku-redis-client');


connect.createServer(
    connect.cookieParser(),
    connect.session({ store: new RedisStore({ client: redis.createClient() }), secret: 'keyboard cat' })
);

See https://github.com/visionmedia/connect-redis/ for information on how to use the returned redisClient as your session store

Using redis as your data store

var redis = require('heroku-redis-client'),
    redisClient = redis.createClient();
redisClient.set('key', 'value');

See https://github.com/mranney/node_redis for information on how to use the wrapped redis

Source

var redis = require('redis'),
    url = require('url');

exports.createClient = function (port_arg, host_arg, options) {
    var client;
    if (process.env.REDISTOGO_URL) {
        var redisURL = url.parse(process.env.REDISTOGO_URL);
        client = redis.createClient(redisURL.port, redisURL.hostname, options);
        client.auth(redisURL.auth.split(":")[1]);
    } else {
        client = redis.createClient(port_arg, host_arg, options);
    }

    return client;
};

exports.redis = redis;

License

MIT

Something went wrong with that request. Please try again.