@@ -57,15 +57,24 @@ See also the [examples](examples).
5757
5858### Factory
5959
60- The ` Factory ` is responsible for creating your ` Client ` instance.
61- It also registers everything with the main ` EventLoop ` .
60+ The ` Factory ` is responsible for creating your [ ` Client ` ] ( #client ) instance.
61+ It also registers everything with the main [ ` EventLoop ` ] ( https://github.com/reactphp/event-loop#usage ) .
6262
6363``` php
6464$loop = \React\EventLoop\Factory::create();
6565$factory = new Factory($loop);
6666```
6767
68- The ` createClient($redisUri) ` method can be used to create a new ` Client ` .
68+ If you need custom DNS, proxy or TLS settings, you can explicitly pass a
69+ custom instance of the [ ` ConnectorInterface ` ] ( https://github.com/reactphp/socket-client#connectorinterface ) :
70+
71+ ``` php
72+ $factory = new Factory($loop, $connector);
73+ ```
74+
75+ #### createClient()
76+
77+ The ` createClient($redisUri) ` method can be used to create a new [ ` Client ` ] ( #client ) .
6978It helps with establishing a plain TCP/IP connection to Redis
7079and optionally authenticating (AUTH) and selecting the right database (SELECT).
7180
@@ -89,6 +98,8 @@ $factory->createClient('localhost')->then(
8998The ` Client ` is responsible for exchanging messages with Redis
9099and keeps track of pending commands.
91100
101+ #### Commands
102+
92103All [ Redis commands] ( http://redis.io/commands ) are automatically available as public methods (via the magic ` __call() ` method) like this:
93104
94105``` php
@@ -106,10 +117,14 @@ $client->subscribe($channel);
106117
107118$client->ping();
108119$client->select($database);
120+
121+ // many more…
109122```
110123
111124Listing all available commands is out of scope here, please refer to the [ Redis command reference] ( http://redis.io/commands ) .
112125
126+ #### Processing
127+
113128Sending commands is async (non-blocking), so you can actually send multiple commands in parallel.
114129Redis will respond to each command request with a response message, pending commands will be pipelined automatically.
115130Sending commands uses a [ Promise] ( https://github.com/reactphp/promise ) -based interface that makes it easy to react to when a command is * fulfilled*
@@ -123,6 +138,8 @@ $client->get('hello')->then(function ($response) {
123138});
124139```
125140
141+ #### on()
142+
126143The ` on($eventName, $eventHandler) ` method can be used to register a new event handler.
127144Incoming events and errors will be forwarded to registered event handler callbacks:
128145
@@ -164,14 +181,18 @@ $client->on('monitor', function (StatusReply $message) {
164181});
165182```
166183
184+ #### close()
185+
167186The ` close() ` method can be used to force-close the Redis connection and reject all pending commands.
168187
169- The ` end() ` method can be used to soft-close the Redis connection once all pending commands are completed.
188+ #### end()
170189
190+ The ` end() ` method can be used to soft-close the Redis connection once all pending commands are completed.
171191
172192## Install
173193
174- The recommended way to install this library is [ through composer] ( http://getcomposer.org ) . [ New to composer?] ( http://getcomposer.org/doc/00-intro.md )
194+ The recommended way to install this library is [ through composer] ( http://getcomposer.org ) .
195+ [ New to composer?] ( http://getcomposer.org/doc/00-intro.md )
175196
176197``` JSON
177198{
0 commit comments