mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Predis to v2.2.2
This commit is contained in:
parent
9510347d3a
commit
969dca5f7e
449 changed files with 22013 additions and 2 deletions
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.add/
|
||||
*
|
||||
* Adds one or more observations to a t-digest sketch.
|
||||
*/
|
||||
class TDIGESTADD extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.ADD';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.byrank/
|
||||
*
|
||||
* Returns, for each input rank, an estimation of the value (floating-point) with that rank.
|
||||
*/
|
||||
class TDIGESTBYRANK extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.BYRANK';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
// convert Relay (RESP3) constants to strings
|
||||
return array_map(function ($value) {
|
||||
if (is_string($value) || !is_float($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_nan($value)) {
|
||||
return 'nan';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case INF: return 'inf';
|
||||
case -INF: return '-inf';
|
||||
default: return $value;
|
||||
}
|
||||
}, $data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.byrevrank/
|
||||
*
|
||||
* Returns, for each input reverse rank, an estimation of the value (floating-point) with that reverse rank.
|
||||
*/
|
||||
class TDIGESTBYREVRANK extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.BYREVRANK';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
// convert Relay (RESP3) constants to strings
|
||||
return array_map(function ($value) {
|
||||
if (is_string($value) || !is_float($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_nan($value)) {
|
||||
return 'nan';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case INF: return 'inf';
|
||||
case -INF: return '-inf';
|
||||
default: return $value;
|
||||
}
|
||||
}, $data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.cdf/
|
||||
*
|
||||
* Returns, for each input value, an estimation of the fraction (floating-point)
|
||||
* of (observations smaller than the given value + half
|
||||
* the observations equal to the given value).
|
||||
*/
|
||||
class TDIGESTCDF extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.CDF';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
// convert Relay (RESP3) constants to strings
|
||||
return array_map(function ($value) {
|
||||
if (is_string($value) || !is_float($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_nan($value)) {
|
||||
return 'nan';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case INF: return 'inf';
|
||||
case -INF: return '-inf';
|
||||
default: return $value;
|
||||
}
|
||||
}, $data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.create/
|
||||
*
|
||||
* Allocates memory and initializes a new t-digest sketch.
|
||||
*/
|
||||
class TDIGESTCREATE extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.CREATE';
|
||||
}
|
||||
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (!empty($arguments[1])) {
|
||||
$arguments[2] = $arguments[1];
|
||||
$arguments[1] = 'COMPRESSION';
|
||||
} elseif (array_key_exists(1, $arguments) && $arguments[1] < 1) {
|
||||
array_pop($arguments);
|
||||
}
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.info/
|
||||
*
|
||||
* Returns information and statistics about a t-digest sketch.
|
||||
*/
|
||||
class TDIGESTINFO extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.INFO';
|
||||
}
|
||||
|
||||
public function parseResponse($data)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
for ($i = 0, $iMax = count($data); $i < $iMax; ++$i) {
|
||||
if (array_key_exists($i + 1, $data)) {
|
||||
$result[(string) $data[$i]] = $data[++$i];
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.max/
|
||||
*
|
||||
* Returns the maximum observation value from a t-digest sketch.
|
||||
*/
|
||||
class TDIGESTMAX extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.MAX';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (is_string($data) || !is_float($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
// convert Relay (RESP3) constants to strings
|
||||
if (is_nan($data)) {
|
||||
return 'nan';
|
||||
}
|
||||
|
||||
switch ($data) {
|
||||
case INF: return 'inf';
|
||||
case -INF: return '-inf';
|
||||
default: return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.merge/
|
||||
*
|
||||
* Merges multiple t-digest sketches into a single sketch.
|
||||
*/
|
||||
class TDIGESTMERGE extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.MERGE';
|
||||
}
|
||||
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
$processedArguments = array_merge([$arguments[0], count($arguments[1])], $arguments[1]);
|
||||
|
||||
for ($i = 2, $iMax = count($arguments); $i < $iMax; $i++) {
|
||||
if (is_int($arguments[$i]) && $arguments[$i] !== 0) {
|
||||
array_push($processedArguments, 'COMPRESSION', $arguments[$i]);
|
||||
} elseif (is_bool($arguments[$i]) && $arguments[$i]) {
|
||||
$processedArguments[] = 'OVERRIDE';
|
||||
}
|
||||
}
|
||||
|
||||
parent::setArguments($processedArguments);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.min/
|
||||
*
|
||||
* Returns the minimum observation value from a t-digest sketch.
|
||||
*/
|
||||
class TDIGESTMIN extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.MIN';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (is_string($data) || !is_float($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
// convert Relay (RESP3) constants to strings
|
||||
if (is_nan($data)) {
|
||||
return 'nan';
|
||||
}
|
||||
|
||||
switch ($data) {
|
||||
case INF: return 'inf';
|
||||
case -INF: return '-inf';
|
||||
default: return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.quantile/
|
||||
*
|
||||
* Returns, for each input fraction, an estimation of the value (floating point) that is smaller than the given fraction of observations.
|
||||
*/
|
||||
class TDIGESTQUANTILE extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.QUANTILE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
// convert Relay (RESP3) constants to strings
|
||||
return array_map(function ($value) {
|
||||
if (is_string($value) || !is_float($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_nan($value)) {
|
||||
return 'nan';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case INF: return 'inf';
|
||||
case -INF: return '-inf';
|
||||
default: return $value;
|
||||
}
|
||||
}, $data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.rank/
|
||||
*
|
||||
* Returns, for each input value (floating-point), the estimated rank
|
||||
* of the value (the number of observations in the sketch that are smaller than
|
||||
* the value + half the number of observations that are equal to the value).
|
||||
*/
|
||||
class TDIGESTRANK extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.RANK';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.reset/
|
||||
*
|
||||
* Resets a t-digest sketch: empty the sketch and re-initializes it.
|
||||
*/
|
||||
class TDIGESTRESET extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.RESET';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.revrank/
|
||||
*
|
||||
* Returns, for each input value (floating-point), the estimated reverse rank
|
||||
* of the value (the number of observations in the sketch that are larger than
|
||||
* the value + half the number of observations that are equal to the value).
|
||||
*/
|
||||
class TDIGESTREVRANK extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.REVRANK';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Predis package.
|
||||
*
|
||||
* (c) 2009-2020 Daniele Alessandri
|
||||
* (c) 2021-2023 Till Krüss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Command\Redis\TDigest;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
|
||||
/**
|
||||
* @see https://redis.io/commands/tdigest.trimmed_mean/
|
||||
*
|
||||
* Returns an estimation of the mean value from the sketch,
|
||||
* excluding observation values outside the low and high cutoff quantiles.
|
||||
*/
|
||||
class TDIGESTTRIMMED_MEAN extends RedisCommand
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'TDIGEST.TRIMMED_MEAN';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (is_string($data) || !is_float($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
// convert Relay (RESP3) constants to strings
|
||||
if (is_nan($data)) {
|
||||
return 'nan';
|
||||
}
|
||||
|
||||
switch ($data) {
|
||||
case INF: return 'inf';
|
||||
case -INF: return '-inf';
|
||||
default: return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue