Skip to content

Commit

Permalink
updated readme of the createClient() part
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhftang committed Aug 7, 2014
1 parent 064260d commit 2a768f3
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,15 @@ resume sending when you get `drain`.

`client` will emit `idle` when there are no outstanding commands that are awaiting a response.

## redis.createClient(port, host, options)
## redis.createClient()

Create a new client connection. `port` defaults to `6379` and `host` defaults
to `127.0.0.1`. If you have `redis-server` running on the same computer as node, then the defaults for
### overloading
* redis.createClient() = redis.createClient(6379, '127.0.0.1', {})
* redis.createClient(options) = redis.createClient(6379, '127.0.0.1', options)
* redis.createClient(unix_socket, options)
* redis.createClient(port, host, options)

If you have `redis-server` running on the same computer as node, then the defaults for
port and host are probably fine. `options` in an object with the following possible properties:

* `parser`: which Redis protocol reply parser to use. Defaults to `hiredis` if that module is installed.
Expand Down Expand Up @@ -234,24 +239,6 @@ You can force an IPv6 if you set the family to 'IPv6'. See nodejs net or dns mod

`createClient()` returns a `RedisClient` object that is named `client` in all of the examples here.

### Unix Domain Socket

You can also create a connection to Redis server via the unix domain socket if the server
has it enabled:

```js
var redis = require("redis");
var client = redis.createClient("/tmp/redis.sock");
```

Sample `redis.conf` configuration to enable unix domain socket listening:

```conf
unixsocket /tmp/redis.sock
unixsocketperm 755
```

See [issue #204](https://github.com/mranney/node_redis/issues/204) for more information.

## client.auth(password, callback)

Expand Down

0 comments on commit 2a768f3

Please sign in to comment.