Skip to content

Commit fceedcf

Browse files
committed
Doc: Proxy Mode
1 parent 911d483 commit fceedcf

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ local redis, err = rc:connect{
104104
}
105105
```
106106

107+
## Proxy Mode
108+
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.
111+
Databases and transactions are also not supported.
112+
113+
Proxy mode will disable switching to a DB on connect.
114+
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.
115+
116+
`discard` will not be sent when adding connections to the keepalive pool
117+
118+
119+
## Disabled commands
120+
121+
If configured as a table of commands, the command methods will be replaced by a function which immediately returns `nil, err` without forwarding the command to the server
107122

108123
## Default Parameters
109124

@@ -115,16 +130,20 @@ local redis, err = rc:connect{
115130
connection_options = {}, -- pool, etc
116131
keepalive_timeout = 60000,
117132
keepalive_poolsize = 30,
118-
133+
119134
host = "127.0.0.1",
120135
port = "6379",
121136
path = "", -- unix socket path, e.g. /tmp/redis.sock
122137
password = "",
123138
db = 0,
124-
139+
125140
master_name = "mymaster",
126141
role = "master", -- master | slave | any
127142
sentinels = {},
143+
144+
connection_is_proxied = false,
145+
146+
disabled_commands = {},
128147
}
129148
```
130149

0 commit comments

Comments
 (0)