Predis to v2.2.2

This commit is contained in:
the-djmaze 2024-04-08 16:29:55 +02:00
parent 9510347d3a
commit 969dca5f7e
449 changed files with 22013 additions and 2 deletions

View file

@ -0,0 +1,29 @@
<?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\CountMinSketch;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/cms.incrby/
*
* Increases the count of item by increment.
* Multiple items can be increased with one call.
*/
class CMSINCRBY extends RedisCommand
{
public function getId()
{
return 'CMS.INCRBY';
}
}

View file

@ -0,0 +1,45 @@
<?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\CountMinSketch;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/cms.info/
*
* Returns width, depth and total count of the sketch.
*/
class CMSINFO extends RedisCommand
{
public function getId()
{
return 'CMS.INFO';
}
public function parseResponse($data)
{
if (count($data) > 1) {
$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;
}
return $data;
}
}

View file

@ -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\CountMinSketch;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/cms.initbydim/
*
* Initializes a Count-Min Sketch to dimensions specified by user.
*/
class CMSINITBYDIM extends RedisCommand
{
public function getId()
{
return 'CMS.INITBYDIM';
}
}

View file

@ -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\CountMinSketch;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/cms.initbyprob/
*
* Initializes a Count-Min Sketch to accommodate requested tolerances.
*/
class CMSINITBYPROB extends RedisCommand
{
public function getId()
{
return 'CMS.INITBYPROB';
}
}

View file

@ -0,0 +1,42 @@
<?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\CountMinSketch;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/cms.merge/
*
* Merges several sketches into one sketch.
* All sketches must have identical width and depth.
* Weights can be used to multiply certain sketches. Default weight is 1.
*/
class CMSMERGE extends RedisCommand
{
public function getId()
{
return 'CMS.MERGE';
}
public function setArguments(array $arguments)
{
$processedArguments = array_merge([$arguments[0], count($arguments[1])], $arguments[1]);
if (!empty($arguments[2])) {
$processedArguments[] = 'WEIGHTS';
$processedArguments = array_merge($processedArguments, $arguments[2]);
}
parent::setArguments($processedArguments);
}
}

View file

@ -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\CountMinSketch;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/cms.query/
*
* Returns the count for one or more items in a sketch.
*/
class CMSQUERY extends RedisCommand
{
public function getId()
{
return 'CMS.QUERY';
}
}