@@ -33,6 +33,7 @@ If you've found phpredis useful and would like to buy the maintainers a coffee (
33
33
* [ Lists] ( #lists )
34
34
* [ Sets] ( #sets )
35
35
* [ Sorted sets] ( #sorted-sets )
36
+ * [ HyperLogLogs] ( #hyperloglogs )
36
37
* [ Geocoding] ( #geocoding )
37
38
* [ Streams] ( #streams )
38
39
* [ Pub/sub] ( #pubsub )
@@ -3114,6 +3115,86 @@ while($arr_matches = $redis->zScan('zset', $it, '*pattern*')) {
3114
3115
}
3115
3116
~~~
3116
3117
3118
+ ## HyperLogLogs
3119
+
3120
+ ### pfAdd
3121
+ -----
3122
+
3123
+ _ ** Description** _ : Adds the specified elements to the specified HyperLogLog.
3124
+
3125
+ ##### * Prototype*
3126
+ ~~~ php
3127
+ $redis->pfAdd($key, Array $elements);
3128
+ ~~~
3129
+
3130
+ ##### * Parameters*
3131
+ _ Key_
3132
+ _ Array of values_
3133
+
3134
+ ##### * Return value*
3135
+ * Integer* : 1 if at least 1 HyperLogLog internal register was altered. 0 otherwise.
3136
+
3137
+ ##### * Example*
3138
+ ~~~ php
3139
+ $redis->pfAdd('hll', ['a', 'b', 'c']); // (int) 1
3140
+ $redis->pfAdd('hll', ['a', 'b']); // (int) 0
3141
+ ~~~
3142
+
3143
+ ### pfCount
3144
+ -----
3145
+
3146
+ _ ** Description** _ : Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
3147
+
3148
+ ##### * Prototype*
3149
+ ~~~ php
3150
+ $redis->pfCount($key);
3151
+ $redis->pfCount(Array $keys);
3152
+ ~~~
3153
+
3154
+ ##### * Parameters*
3155
+ _ Key_ or _ Array of keys_
3156
+
3157
+ ##### * Return value*
3158
+ * Integer* : The approximated number of unique elements observed via [ pfAdd] ( #pfAdd ) .
3159
+
3160
+ ##### * Example*
3161
+ ~~~ php
3162
+ $redis->pfAdd('hll1', ['a', 'b', 'c']); // (int) 1
3163
+ $redis->pfCount('hll1'); // (int) 3
3164
+
3165
+ $redis->pfAdd('hll2', ['d', 'e', 'a']); // (int) 1
3166
+ $redis->pfCount('hll2'); // (int) 3
3167
+
3168
+ $redis->pfCount(['hll1', 'hll2']); // (int) 5
3169
+ ~~~
3170
+
3171
+ ### pfMerge
3172
+ -----
3173
+
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
+
3117
3198
## Geocoding
3118
3199
3119
3200
### geoAdd
0 commit comments