toalett-redis-timeseries/src/Protocol/Command.php

50 lines
1.4 KiB
PHP

<?php
namespace Toalett\Redis\Timeseries\Protocol;
use Toalett\Redis\Timeseries\Model\Aggregation;
use Toalett\Redis\Timeseries\Model\Value;
use Toalett\Redis\Timeseries\Protocol\Command\AddCommand;
use Toalett\Redis\Timeseries\Protocol\Command\AlterCommand;
use Toalett\Redis\Timeseries\Protocol\Command\CreateCommand;
use Toalett\Redis\Timeseries\Protocol\Command\CreateRuleCommand;
use Toalett\Redis\Timeseries\Protocol\Command\DeleteCommand;
use Toalett\Redis\Timeseries\Protocol\Command\DeleteRuleCommand;
final class Command
{
private function __construct()
{
}
public static function add(string $key, Value $value): AddCommand
{
return new AddCommand($key, $value);
}
public static function alter(string $key): AlterCommand
{
return new AlterCommand($key);
}
public static function create(string $key): CreateCommand
{
return new CreateCommand($key);
}
public static function createRule(string $sourceKey, string $destinationKey, Aggregation $aggregation): CreateRuleCommand
{
return new CreateRuleCommand($sourceKey, $destinationKey, $aggregation);
}
public static function delete(string $key): DeleteCommand
{
return new DeleteCommand($key);
}
public static function deleteRule(string $sourceKey, string $destinationKey): DeleteRuleCommand
{
return new DeleteRuleCommand($sourceKey, $destinationKey);
}
}