Skip to content

Support 1.4 features #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ RUN pecl install redis && \
pecl install xdebug && \
docker-php-ext-enable redis xdebug

RUN wget https://github.com/composer/composer/releases/download/1.10.10/composer.phar -q &&\
RUN wget https://github.com/composer/composer/releases/download/2.0.12/composer.phar -q && \
mv composer.phar /usr/bin/composer && \
chmod +x /usr/bin/composer

20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ Use [Redis Time Series](https://oss.redislabs.com/redistimeseries/) in PHP!
### Requirements
The library is tested against:
- PHP 7.2, 7.3 and 7.4
- RedisTimeSeries 1.2.7 and 1.4.2 (but it should work with any 1.2 and 1.4 version)
- RedisTimeSeries 1.4.8 (but it should work with any 1.4 version)

In order to use RedisTimeSeries 1.2 please use version 2.1.1 of this library.

### Construct
```
Expand Down Expand Up @@ -113,20 +115,26 @@ See https://oss.redislabs.com/redistimeseries/commands/#tsdeleterule.

### `range`

`TimeSeries::range(string $key, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null): Sample[]`
`TimeSeries::range(string $key, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null, bool $reverse = false): Sample[]`

Retrieves samples from a key. It's possible to limit the query in a given time frame (passing `$from` and `$to`),
to limit the retrieved amount of samples (passing `$count`), and also to pre-aggregate the results using a `$rule`.

The flag `$reverse` will return the results in reverse time order.

See https://oss.redislabs.com/redistimeseries/commands/#tsrange.

### `multiRange` and `multiRangeRaw`
### `multiRange` and `multiRangeWithLabels`

`TimeSeries::multiRange(Filter $filter, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null, bool $reverse = false): Sample[]`

`TimeSeries::multiRangeWithLabels(Filter $filter, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null, bool $reverse = false): SampleWithLabels[]`

`TimeSeries::multiRange(Filter $filter, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null): Sample[]`
Similar to `range`, but instead of querying by key, queries for a specific set of labels specified in `$filter`.

`TimeSeries::multiRangeRaw(Filter $filter, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null): array[]`
`multiRangeWithLabels` will return an array of `SampleWithLabels` instead of simple `Sample`s.

Similar to `range`, but instead of querying by key, queries for a specific set of labels specified in `$filter`. `multiRangeRaw` will return the raw result from Redis, in order to preserve label information.
The flag `$reverse` will return the results in reverse time order.

See https://oss.redislabs.com/redistimeseries/commands/#tsmrange.

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "palicao/php-redis-time-series",
"description": "Use Redis Time Series in PHP",
"license": "MIT",
"authors": [
{
Expand All @@ -23,6 +24,6 @@
},
"require-dev": {
"phpunit/phpunit": "^8.3",
"vimeo/psalm": "^3.5"
"vimeo/psalm": "^4.7"
}
}
Loading