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,39 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.add/
*
* Append a sample to a time series.
*/
class TSADD extends RedisCommand
{
public function getId()
{
return 'TS.ADD';
}
public function setArguments(array $arguments)
{
[$key, $timestamp, $value] = $arguments;
$commandArguments = (!empty($arguments[3])) ? $arguments[3]->toArray() : [];
parent::setArguments(array_merge(
[$key, $timestamp, $value],
$commandArguments
));
}
}

View file

@ -0,0 +1,39 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.alter/
*
* Update the retention, chunk size, duplicate policy, and labels of an existing time series.
*/
class TSALTER extends RedisCommand
{
public function getId()
{
return 'TS.ALTER';
}
public function setArguments(array $arguments)
{
[$key] = $arguments;
$commandArguments = (!empty($arguments[1])) ? $arguments[1]->toArray() : [];
parent::setArguments(array_merge(
[$key],
$commandArguments
));
}
}

View file

@ -0,0 +1,39 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.create/
*
* Create a new time series.
*/
class TSCREATE extends RedisCommand
{
public function getId()
{
return 'TS.CREATE';
}
public function setArguments(array $arguments)
{
[$key] = $arguments;
$commandArguments = (!empty($arguments[1])) ? $arguments[1]->toArray() : [];
parent::setArguments(array_merge(
[$key],
$commandArguments
));
}
}

View file

@ -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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.createrule/
*
* Create a compaction rule
*/
class TSCREATERULE extends RedisCommand
{
public function getId()
{
return 'TS.CREATERULE';
}
public function setArguments(array $arguments)
{
[$sourceKey, $destKey, $aggregator, $bucketDuration] = $arguments;
$processedArguments = [$sourceKey, $destKey, 'AGGREGATION', $aggregator, $bucketDuration];
if (count($arguments) === 5) {
$processedArguments[] = $arguments[4];
}
parent::setArguments($processedArguments);
}
}

View file

@ -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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.decrby/
*
* Decrease the value of the sample with the maximum existing timestamp,
* or create a new sample with a value equal to the value of the sample
* with the maximum existing timestamp with a given decrement.
*/
class TSDECRBY extends RedisCommand
{
public function getId()
{
return 'TS.DECRBY';
}
public function setArguments(array $arguments)
{
[$key, $value] = $arguments;
$commandArguments = (!empty($arguments[2])) ? $arguments[2]->toArray() : [];
parent::setArguments(array_merge(
[$key, $value],
$commandArguments
));
}
}

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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.del/
*
* Delete all samples between two timestamps for a given time series.
*/
class TSDEL extends RedisCommand
{
public function getId()
{
return 'TS.DEL';
}
}

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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.deleterule/
*
* Delete a compaction rule.
*/
class TSDELETERULE extends RedisCommand
{
public function getId()
{
return 'TS.DELETERULE';
}
}

View file

@ -0,0 +1,39 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.get/
*
* Get the sample with the highest timestamp from a given time series.
*/
class TSGET extends RedisCommand
{
public function getId()
{
return 'TS.GET';
}
public function setArguments(array $arguments)
{
[$key] = $arguments;
$commandArguments = (!empty($arguments[1])) ? $arguments[1]->toArray() : [];
parent::setArguments(array_merge(
[$key],
$commandArguments
));
}
}

View file

@ -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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.incrby/
*
* Increase the value of the sample with the maximum existing timestamp,
* or create a new sample with a value equal to the value of the sample
* with the maximum existing timestamp with a given increment
*/
class TSINCRBY extends RedisCommand
{
public function getId()
{
return 'TS.INCRBY';
}
public function setArguments(array $arguments)
{
[$key, $value] = $arguments;
$commandArguments = (!empty($arguments[2])) ? $arguments[2]->toArray() : [];
parent::setArguments(array_merge(
[$key, $value],
$commandArguments
));
}
}

View file

@ -0,0 +1,39 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.info/
*
* Return information and statistics for a time series.
*/
class TSINFO extends RedisCommand
{
public function getId()
{
return 'TS.INFO';
}
public function setArguments(array $arguments)
{
[$key] = $arguments;
$commandArguments = (!empty($arguments[1])) ? $arguments[1]->toArray() : [];
parent::setArguments(array_merge(
[$key],
$commandArguments
));
}
}

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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.madd/
*
* Append new samples to one or more time series.
*/
class TSMADD extends RedisCommand
{
public function getId()
{
return 'TS.MADD';
}
}

View file

@ -0,0 +1,37 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
class TSMGET extends RedisCommand
{
public function getId()
{
return 'TS.MGET';
}
public function setArguments(array $arguments)
{
$processedArguments = [];
$argumentsObject = array_shift($arguments);
$commandArguments = $argumentsObject->toArray();
array_push($processedArguments, 'FILTER', ...$arguments);
parent::setArguments(array_merge(
$commandArguments,
$processedArguments
));
}
}

View file

@ -0,0 +1,39 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.mrange/
*
* Query a range across multiple time series by filters in forward direction.
*/
class TSMRANGE extends RedisCommand
{
public function getId()
{
return 'TS.MRANGE';
}
public function setArguments(array $arguments)
{
[$fromTimestamp, $toTimestamp] = $arguments;
$commandArguments = $arguments[2]->toArray();
parent::setArguments(array_merge(
[$fromTimestamp, $toTimestamp],
$commandArguments
));
}
}

View file

@ -0,0 +1,26 @@
<?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\TimeSeries;
/**
* @see https://redis.io/commands/ts.mrevrange/
*
* Query a range across multiple time series by filters in reverse direction.
*/
class TSMREVRANGE extends TSMRANGE
{
public function getId()
{
return 'TS.MREVRANGE';
}
}

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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.queryindex/
*
* Get all time series keys matching a filter list.
*/
class TSQUERYINDEX extends RedisCommand
{
public function getId()
{
return 'TS.QUERYINDEX';
}
}

View file

@ -0,0 +1,39 @@
<?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\TimeSeries;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ts.range/
*
* Query a range in forward direction.
*/
class TSRANGE extends RedisCommand
{
public function getId()
{
return 'TS.RANGE';
}
public function setArguments(array $arguments)
{
[$key, $fromTimestamp, $toTimestamp] = $arguments;
$commandArguments = (!empty($arguments[3])) ? $arguments[3]->toArray() : [];
parent::setArguments(array_merge(
[$key, $fromTimestamp, $toTimestamp],
$commandArguments
));
}
}

View file

@ -0,0 +1,26 @@
<?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\TimeSeries;
/**
* @see https://redis.io/commands/ts.revrange/
*
* Query a range in reverse direction.
*/
class TSREVRANGE extends TSRANGE
{
public function getId()
{
return 'TS.REVRANGE';
}
}