26 lines
555 B
PHP
26 lines
555 B
PHP
|
<?php
|
||
|
|
||
|
namespace Toalett\Redis\Timeseries;
|
||
|
|
||
|
use Toalett\Redis\Timeseries\Model\Value;
|
||
|
use Toalett\Redis\Timeseries\Protocol\Command as C;
|
||
|
|
||
|
final class Timeseries
|
||
|
{
|
||
|
private CommandBus $commandBus;
|
||
|
private string $key;
|
||
|
|
||
|
public function __construct(CommandBus $commandBus, string $key)
|
||
|
{
|
||
|
$this->commandBus = $commandBus;
|
||
|
$this->key = $key;
|
||
|
}
|
||
|
|
||
|
public function add(Value ...$values): void
|
||
|
{
|
||
|
foreach ($values as $value) {
|
||
|
$this->commandBus->dispatch(C::add($this->key, $value));
|
||
|
}
|
||
|
}
|
||
|
}
|