Skip to content

Commit 0ca86ca

Browse files
committed
Documented chanages
1 parent 79d5bf8 commit 0ca86ca

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ local rc = require("resty.redis.connector").new({
3939
connect_timeout = 50,
4040
read_timeout = 5000,
4141
keepalive_timeout = 30000,
42-
42+
4343
host = "127.0.0.1",
4444
port = 6379,
4545
db = 2,
@@ -53,7 +53,7 @@ local redis, err = rc:connect()
5353
local ok, err = rc:set_keepalive(redis)
5454
```
5555

56-
`connect` can be used to override defaults given in `new`
56+
[connect](#connect) can be used to override some defaults given in [new](#new), which are pertinent to this connection only.
5757

5858

5959
```lua
@@ -71,7 +71,9 @@ local redis, err = rc:connect({
7171

7272
## DSN format
7373

74-
If the `params.url` field is present then it will be parsed, overriding values supplied in the parameters table.
74+
If the `params.url` field is present then it will be parsed to set the other params. Any manually specified params will override values given in the DSN.
75+
76+
*Note: this is a behaviour change as of v0.06. Previously, the DSN values would take precedence.*
7577

7678
### Direct Redis connections
7779

@@ -87,11 +89,7 @@ When connecting via Redis Sentinel, the format is as follows:
8789

8890
`sentinel://PASSWORD@MASTER_NAME:ROLE/DB`
8991

90-
Again, `PASSWORD` and `DB` are optional. `ROLE` must be any of `m`, `s` or `a`, meaning:
91-
92-
* `m`: master
93-
* `s`: slave
94-
* `a`: any (first tries the master, but will failover to a slave if required)
92+
Again, `PASSWORD` and `DB` are optional. `ROLE` must be either `m` or `s` for master / slave respectively.
9593

9694
A table of `sentinels` must also be supplied. e.g.
9795

@@ -106,11 +104,11 @@ local redis, err = rc:connect{
106104

107105
## Proxy Mode
108106

109-
Enable the `connection_is_proxied` parameter if connecting to Redis through a proxy service (e.g. Twemproxy).
110-
These proxies generally only support a limited sub-set of Redis commands, those which do not require state and do not affect multiple keys.
107+
Enable the `connection_is_proxied` parameter if connecting to Redis through a proxy service (e.g. Twemproxy).
108+
These proxies generally only support a limited sub-set of Redis commands, those which do not require state and do not affect multiple keys.
111109
Databases and transactions are also not supported.
112110

113-
Proxy mode will disable switching to a DB on connect.
111+
Proxy mode will disable switching to a DB on connect.
114112
Unsupported commands (defaults to those not supported by Twemproxy) will return `nil, err` immediately rather than being sent to the proxy, which can result in dropped connections.
115113

116114
`discard` will not be sent when adding connections to the keepalive pool
@@ -138,7 +136,7 @@ If configured as a table of commands, the command methods will be replaced by a
138136
db = 0,
139137

140138
master_name = "mymaster",
141-
role = "master", -- master | slave | any
139+
role = "master", -- master | slave
142140
sentinels = {},
143141

144142
connection_is_proxied = false,
@@ -174,6 +172,13 @@ Creates the Redis Connector object, overring default params with the ones given.
174172

175173
Attempts to create a connection, according to the [params](#parameters) supplied, falling back to defaults given in `new` or the predefined defaults. If a connection cannot be made, returns `nil` and a string describing the reason.
176174

175+
Note that `params` given here do not change the connector's own configuration, and are only used to alter this particular connection operation. As such, the following parameters have no meaning when given in `connect`.
176+
177+
* `keepalive_poolsize`
178+
* `keepalive_timeout`
179+
* `connection_is_proxied`
180+
* `disabled_commands`
181+
177182

178183
### set_keepalive
179184

0 commit comments

Comments
 (0)