diff options
author | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2019-01-11 11:04:56 +0300 |
---|---|---|
committer | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2019-01-11 11:04:56 +0300 |
commit | f6380cb828133488a50e173b6f91a303635810f3 (patch) | |
tree | 58af62723a1555956eb9c35b76f9fbf9073b4f56 /arrays.markdown | |
parent | 850027ffd36ce224846d142fd3fb5344f08aef16 (diff) |
Add documentation
Diffstat (limited to 'arrays.markdown')
-rw-r--r-- | arrays.markdown | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arrays.markdown b/arrays.markdown index c41ef616..cd6394d1 100644 --- a/arrays.markdown +++ b/arrays.markdown @@ -61,6 +61,19 @@ The read_timeout value is a double and is used to specify a timeout in number of $ra = new RedisArray(array("host1", "host2:63792", "host2:6380"), array("read_timeout" => 0.5)); </pre> +#### Specifying the "algorithm" parameter +The algorithm value is a string and is used to specify the name of key hashing algorithm. The list of possible values may be found using PHP function `hash_algos`. +If algorithm is not supported by PHP `hash` function default algorithm will be used (CRC32 with 0xffffffff initial value). +<pre> +$ra = new RedisArray(array("host1", "host2:63792", "host2:6380"), array("algorithm" => "md5")); +</pre> + +#### Specifying the "consistent" parameter +The value is boolean. When enabled RedisArray uses "ketama" distribution algorithm (currently without ability to set weight to each server). +This option applies to main and previous ring if specified. +<pre> +$ra = new RedisArray(array("host1", "host2:63792", "host2:6380"), array("consistent" => true)); +</pre> #### Defining arrays in Redis.ini @@ -152,6 +165,7 @@ RedisArray objects provide several methods to help understand the state of the c * `$ra->_function()` → returns the name of the function used to extract key parts during consistent hashing. * `$ra->_target($key)` → returns the host to be used for a certain key. * `$ra->_instance($host)` → returns a redis instance connected to a specific node; use with `_target` to get a single Redis object. +* `$ra->_continuum()` → returns a list of points on continuum; may be useful with custom distributor function. ## Running the unit tests <pre> |