diff options
author | Ali Alwash <alitrix@gmail.com> | 2020-07-21 20:22:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-21 20:22:27 +0300 |
commit | c9ed151dbae1532a98c0c9322c9401c47d1da149 (patch) | |
tree | 5f2f643c2644a119746e372ce76886d2f97157ce /README.markdown | |
parent | a7662da7924dcbaa74f5f2c6e1dce06b19e64bfc (diff) |
Update zAdd/zRangeByScore documentation (#1815)
* Update zAdd functionality
* Fix readability additional params
* Add example of -inf/+inf for zRangeByScore
Diffstat (limited to 'README.markdown')
-rw-r--r-- | README.markdown | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown index 40377223..296cf96c 100644 --- a/README.markdown +++ b/README.markdown @@ -2763,10 +2763,19 @@ $redis->bzPopMax('zs1', 'zs2', 5); ----- _**Description**_: Add one or more members to a sorted set or update its score if it already exists + +##### *Prototype* +~~~php +$redis->zAdd($key, [ $options ,] $score, $value [, $score1, $value1, ...]); +~~~ + ##### *Parameters* -*key* +*key*: string +*options*: array (optional) *score*: double *value*: string +*score1*: double +*value1*: string ##### *Return value* *Long* 1 if the element is added. 0 otherwise. @@ -2777,6 +2786,9 @@ $redis->zAdd('key', 1, 'val1'); $redis->zAdd('key', 0, 'val0'); $redis->zAdd('key', 5, 'val5'); $redis->zRange('key', 0, -1); // [val0, val1, val5] + +// From Redis 3.0.2 it's possible to add options like XX, NX, CH, INCR +$redis->zAdd('key', ['CH'], 5, 'val5', 10, 'val10', 15, 'val15'); ~~~ ### zCard, zSize @@ -2960,6 +2972,7 @@ $redis->zRangeByScore('key', 0, 3); /* ['val0', 'val2'] */ $redis->zRangeByScore('key', 0, 3, ['withscores' => TRUE]); /* ['val0' => 0, 'val2' => 2] */ $redis->zRangeByScore('key', 0, 3, ['limit' => [1, 1]]); /* ['val2'] */ $redis->zRangeByScore('key', 0, 3, ['withscores' => TRUE, 'limit' => [1, 1]]); /* ['val2' => 2] */ +$redis->zRangeByScore('key', '-inf', '+inf', ['withscores' => TRUE]); /* ['val0' => 0, 'val2' => 2, 'val10' => 10] */ ~~~ ### zRangeByLex |