Skip to content

Commit 88f769c

Browse files
committed
Update README.md
1 parent c6d055c commit 88f769c

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ local redis, err = rc:connect{
8080
* [set_read_timeout](#set_read_timeout)
8181
* [set_connection_options](#set_connection_options)
8282
* [connect](#connect)
83+
* [Utilities](#utilities)
84+
* [connect_via_sentinel](#connect_via_sentinel)
85+
* [try_hosts](#try_hosts)
86+
* [connect_to_host](#connect_to_host)
87+
* [Sentinel Utilities](#sentinel-utilities)
88+
* [sentinel.get_master](#sentinel_get_master)
89+
* [sentinel.get_slaves](#sentinel_get_slaves)
8390

8491

8592
### new
@@ -119,6 +126,46 @@ method.
119126
Attempts to create a connection, according to the [params](#parameters) supplied.
120127

121128

129+
## Utilities
130+
131+
### connect_via_sentinel
132+
133+
`syntax: redis, err = rc:connect_via_sentinel(sentinels, master_name, role)`
134+
135+
Returns a Redis connection by first accessing a sentinel as supplied by the `sentinels` table,
136+
and querying this with the `master_name` and `role`.
137+
138+
139+
### try_hosts
140+
141+
`syntax: redis, err = rc:try_hosts(hosts)`
142+
143+
Tries the hosts supplied in order and returns the first successful connection.
144+
145+
146+
### connect_to_host
147+
148+
`syntax: redis, err = rc:connect_to_host(host)`
149+
150+
Attempts to connect to the supplied `host`.
151+
152+
153+
## Sentinel Utilities
154+
155+
### sentinel.get_master
156+
157+
`syntax: master, err = sentinel.get_master(sentinel, master_name)`
158+
159+
Given a connected Sentinel instance and a master name, will return the current master Redis instance.
160+
161+
162+
### sentinel.get_slaves
163+
164+
`syntax: slaves, err = sentinel.get_slaves(sentinel, master_name)`
165+
166+
Given a connected Sentinel instance and a master name, will return a list of registered slave Redis instances.
167+
168+
122169
## TODO
123170

124171
* Redis Cluster support.

0 commit comments

Comments
 (0)