You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.markdown
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,7 @@ You can also make a one-time contribution with one of the links below.
35
35
1.[Classes and methods](#classes-and-methods)
36
36
*[Usage](#usage)
37
37
*[Connection](#connection)
38
+
*[Retry and backoff](#retry-and-backoff)
38
39
*[Server](#server)
39
40
*[Keys and strings](#keys-and-strings)
40
41
*[Hashes](#hashes)
@@ -428,6 +429,41 @@ _**Description**_: Sends a string to Redis, which replies with the same string
428
429
429
430
*STRING*: the same message.
430
431
432
+
## Retry and backoff
433
+
434
+
1.[Maximum retries](#maximum-retries)
435
+
1.[Backoff algorithms](#backoff-algorithms)
436
+
437
+
### Maximum retries
438
+
You can set and get the maximum retries upon connection issues using the `OPT_MAX_RETRIES` option. Note that this is the number of _retries_, meaning if you set this option to _n_, there will be a maximum _n+1_ attemps overall. Defaults to 10.
439
+
440
+
##### *Example*
441
+
442
+
~~~php
443
+
$redis->setOption(Redis::OPT_MAX_RETRIES, 5);
444
+
$redis->getOption(Redis::OPT_MAX_RETRIES);
445
+
~~~
446
+
447
+
### Backoff algorithms
448
+
You can set the backoff algorithm using the `Redis::OPT_BACKOFF_ALGORITHM` option and choose among the following algorithms described in this blog post by Marc Brooker from AWS: [Exponential Backoff And Jitter](https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter):
These algorithms depend on the _base_ and _cap_ parameters, both in milliseconds, which you can set using the `Redis::OPT_BACKOFF_BASE` and `Redis::OPT_BACKOFF_CAP` options, respectively.
0 commit comments