for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Webdcg\Redis\Traits;
trait HyperLogLogs
{
/**
* Adds the specified elements to the specified HyperLogLog.
*
* @param string $key
* @param array $elements
* @return int 1 if at least 1 HyperLogLog internal register
* was altered. 0 otherwise.
*/
public function pfAdd(string $key, array $elements): int
return $this->redis->pfAdd($key, $elements);
redis
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
* @param $keys
* @return int The approximated number of unique elements observed via pfAdd.
public function pfCount(...$keys): int
return $this->redis->pfCount(...$keys);
* Merge N different HyperLogLogs into a single one.
* @param string $destKey
* @param array $sourceKeys
* @return bool TRUE on success, FALSE on error.
public function pfMerge(string $destKey, array $sourceKeys): bool
return $this->redis->pfMerge($destKey, $sourceKeys);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: