Skip to content

Commit

Permalink
recovery code
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Oct 26, 2012
1 parent d9f309e commit 799b397
Show file tree
Hide file tree
Showing 10 changed files with 594 additions and 4 deletions.
100 changes: 100 additions & 0 deletions History.md
@@ -0,0 +1,100 @@

1.2.0 / 2011-11-17
==================

* Added an option 'client' to reuse an existing redis Client [Thomas Fritz]

1.1.0 / 2011-10-05
==================

* Added `prefix` option
* Removed `clear()` and `length()` methods

1.0.7 / 2011-08-04
==================

* Fixed: re-select db on connection (reconnection logic issue with node_redis)

1.0.6 / 2011-06-21
==================

* Added `socket` option so that we can connect to a sockets as well [mekwall]

1.0.5 / 2011-06-02
==================

* Implemented `require("connect-redis")(connect)` for npm 1.x. Closes #23

1.0.4 / 2011-05-01
==================

* Changed; issue SELECT immediately since it is queued

1.0.3 / 2011-04-17
==================

* Fixed auth support again [garrensmith]

1.0.2 / 2011-04-15
==================

* Fixed auth support [garrensmith]

1.0.1 / 2011-04-14
==================

* Added authentication support [garrensmith]

1.0.0 / 2011-02-25
==================

* Added connect 1.0 support.
This release will _not_ work with older versions of connect.

0.2.3 / 2011-02-01
==================

* Refactoring

0.2.2 / 2011-01-02
==================

* Added `db` option [Clément]

0.2.1 / 2010-12-20
==================

* Redis is now an npm dep

0.2.0 / 2010-11-01
==================

* Use __SETEX__ instead of __SET__ / __EXPIRE__ combo
this should be reasonably faster.

0.1.3 / 2010-10-25
==================

* Updated redis

0.1.2 / 2010-09-22
==================

* Updated redis

0.1.1 / 2010-09-20
==================

* Fixed expires, `maxAge` in seconds
* Updated redis

0.1.0 / 2010-09-17
==================

* Now using node_redis as the client, much faster

0.0.2 / 2010-07-27
==================

* Moved redis to lib/redis
* Added lib/connect-redis.js
7 changes: 7 additions & 0 deletions Makefile
@@ -0,0 +1,7 @@

index.html: lib/connect-redis.js
dox \
--title "Connect Redis" \
--desc "Redis session store for connect backed by [node_redis](http://github.com/mranney/node_redis)." \
--ribbon "http://github.com/visionmedia/connect-redis" \
$< > $@
4 changes: 0 additions & 4 deletions README.md

This file was deleted.

37 changes: 37 additions & 0 deletions Readme.md
@@ -0,0 +1,37 @@

# Connect Redis

connect-redis is a Redis session store backed by [node_redis](http://github.com/mranney/node_redis), and is insanely fast :). Requires redis >= `1.3.10` for the _SETEX_ command.

connect-redis `>= 1.0.0` support only connect `>= 1.0.0`.

## Installation

$ npm install connect-redis

## Options

- `client` An existing redis client object you normally get from `redis.createClient()`
- `host` Redis server hostname
- `port` Redis server portno
- `db` Database index to use
- `pass` Password for Redis authentication
- `prefix` Key prefix defaulting to "sess:"
- ... Remaining options passed to the redis `createClient()` method.

## Usage

Due to npm 1.x changes, we now need to pass connect to the function `connect-redis` exports in order to extend `connect.session.Store`:

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

connect.createServer(
connect.cookieParser(),
// 5 minutes
connect.session({ store: new RedisStore, secret: 'keyboard cat' })
);

This means express users may do the following, since `express.session.Store` points to the `connect.session.Store` function:

var RedisStore = require('connect-redis')(express);
21 changes: 21 additions & 0 deletions bm.js
@@ -0,0 +1,21 @@

var redis = require('./lib/redis')
, times = 100000;

var n = times
, pending = n
, client = redis.createClient()
, start = new Date;

client.on('connect', function(){
while (n--) {
client.set('foo:' + n, 'bar', function(err){
if (err) throw err;
--pending || report();
});
}
});

function report() {
console.log('\x1b[33m%d\x1b[0m sets in \x1b[32m%d\x1b[0m milliseconds', times, new Date - start);
}

0 comments on commit 799b397

Please sign in to comment.