File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 223
223
See lib/redis/errors.rb for information about what exceptions are possible.
224
224
225
225
226
+ ## Timeouts
227
+
228
+ The client allows you to configure connect, read, and write timeouts.
229
+ Passing a single ` timeout ` option will set all three values:
230
+
231
+ ``` ruby
232
+ Redis .new (:timeout => 1 )
233
+ ```
234
+
235
+ But you can use specific values for each of them:
236
+
237
+ ``` ruby
238
+ Redis .new (
239
+ :connect_timeout => 0.2 ,
240
+ :read_timeout => 1.0 ,
241
+ :write_timeout => 0.5
242
+ )
243
+ ```
244
+
245
+ When using pub/sub, you can subscribe to a channel using a timeout as well:
246
+
247
+ ``` ruby
248
+ redis.subscribe_with_timeout(5 , " news" ) do |on |
249
+ on.message do |channel , message |
250
+ # ...
251
+ end
252
+ end
253
+ ```
254
+
255
+ If no message is received after 5 seconds, the client will unsubscribe.
256
+
257
+
226
258
## Expert-Mode Options
227
259
228
260
- ` inherit_socket: true ` : disable safety check that prevents a forked child
You can’t perform that action at this time.
0 commit comments