Skip to content

Commit 9686757

Browse files
committed
HyperLogLogs- pfMerge
1 parent 96a0f0c commit 9686757

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

README.markdown

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,31 +3120,39 @@ while($arr_matches = $redis->zScan('zset', $it, '*pattern*')) {
31203120
### pfAdd
31213121
-----
31223122

3123+
_**Description**_: Adds the specified elements to the specified HyperLogLog.
3124+
31233125
##### *Prototype*
31243126
~~~php
31253127
$redis->pfAdd($key, Array $elements);
31263128
~~~
31273129

3128-
_**Description**_: Adds the specified elements to the specified HyperLogLog.
3130+
##### *Parameters*
3131+
_Key_
3132+
_Array of values_
31293133

31303134
##### *Return value*
31313135
*Integer*: 1 if at least 1 HyperLogLog internal register was altered. 0 otherwise.
31323136

31333137
##### *Example*
31343138
~~~php
3135-
$redis->pfAdd('hll', ['a', 'b', 'c']);
3139+
$redis->pfAdd('hll', ['a', 'b', 'c']); // (int) 1
3140+
$redis->pfAdd('hll', ['a', 'b']); // (int) 0
31363141
~~~
31373142

31383143
### pfCount
31393144
-----
31403145

3146+
_**Description**_: Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
3147+
31413148
##### *Prototype*
31423149
~~~php
31433150
$redis->pfCount($key);
31443151
$redis->pfCount(Array $keys);
31453152
~~~
31463153

3147-
_**Description**_: Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
3154+
##### *Parameters*
3155+
_Key_ or _Array of keys_
31483156

31493157
##### *Return value*
31503158
*Integer*: The approximated number of unique elements observed via [pfAdd](#pfAdd).
@@ -3163,6 +3171,30 @@ $redis->pfCount(['hll1', 'hll2']); // (int) 5
31633171
### pfMerge
31643172
-----
31653173

3174+
_**Description**_: Merge N different HyperLogLogs into a single one.
3175+
3176+
##### *Prototype*
3177+
~~~php
3178+
$redis->pfMerge($destkey, Array $sourceKeys);
3179+
~~~
3180+
3181+
##### *Parameters*
3182+
_Destination Key_
3183+
_Array of Source Keys_
3184+
3185+
##### *Return value*
3186+
*BOOL*: `TRUE` on success, `FALSE` on error.
3187+
3188+
##### *Example*
3189+
~~~php
3190+
$redis->pfAdd('hll1', ['a', 'b', 'c']); // (int) 1
3191+
$redis->pfAdd('hll2', ['d', 'e', 'a']); // (int) 1
3192+
3193+
$redis->pfMerge('hll3', ['hll1', 'hll2']); // true
3194+
3195+
$redis->pfCount('hll3'); // (int) 5
3196+
~~~
3197+
31663198
## Geocoding
31673199

31683200
### geoAdd

0 commit comments

Comments
 (0)