1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

Add magical auth command.

Authentication is now remembered by the client and will be automatically sent to the server
on every connection, including any reconnections.
This commit is contained in:
Matt Ranney
2011-02-27 23:10:44 -10:00
parent 2534f740aa
commit 1a14e24faa
7 changed files with 99 additions and 40 deletions

View File

@@ -181,6 +181,13 @@ objects instead of JavaScript Strings.
`createClient()` returns a `RedisClient` object that is named `client` in all of the examples here.
## client.auth(password, callback)
When connecting to Redis servers that require authentication, the `AUTH` command must be sent as the
first command after connecting. This can be tricky to coordinate with reconnections, the ready check,
etc. To make this easier, `client.auth()` stashes `password` and will send it after each connection,
including reconnections. `callback` is invoked only once, after the response to the very first
`AUTH` command sent.
## client.end()