Skip to content

Commit 6139371

Browse files
authored
Insure compatibility with RedisTimeSeries 1.4.2
also bump the default php version to 7.4
1 parent 4ab7007 commit 6139371

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
language: php
2+
dist: bionic
23

34
php:
45
- 7.2
56
- 7.3
67
- 7.4
78

89
env:
9-
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=1.2.2
10+
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=1.2.7
11+
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=1.4.2
1012
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=edge
1113

1214
jobs:
@@ -25,7 +27,7 @@ before_install:
2527
before_script:
2628
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
2729
- chmod +x ./cc-test-reporter
28-
- if [ $(phpenv version-name) = "7.4" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$REDIS_TIMESERIES_VERSION" == "1.2.2" ]; then ./cc-test-reporter before-build; fi
30+
- if [ $(phpenv version-name) = "7.4" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$REDIS_TIMESERIES_VERSION" == "1.4.2" ]; then ./cc-test-reporter before-build; fi
2931

3032
script:
3133
- composer install
@@ -35,4 +37,4 @@ script:
3537
after_script:
3638
- docker stop redis
3739
- docker rm redis
38-
- if [ $(phpenv version-name) = "7.4" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$REDIS_TIMESERIES_VERSION" == "1.2.2" ]; then ./cc-test-reporter after-build --coverage-input-type clover --id $CC_TEST_REPORTER_ID --exit-code $TRAVIS_TEST_RESULT; fi
40+
- if [ $(phpenv version-name) = "7.4" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$REDIS_TIMESERIES_VERSION" == "1.4.2" ]; then ./cc-test-reporter after-build --coverage-input-type clover --id $CC_TEST_REPORTER_ID --exit-code $TRAVIS_TEST_RESULT; fi

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.3-cli
1+
FROM php:7.4-cli
22
ARG DEBIAN_FRONTEND=noninteractive
33
WORKDIR /app
44

@@ -11,7 +11,7 @@ RUN pecl install redis && \
1111
pecl install xdebug && \
1212
docker-php-ext-enable redis xdebug
1313

14-
RUN wget https://github.com/composer/composer/releases/download/1.9.1/composer.phar -q &&\
14+
RUN wget https://github.com/composer/composer/releases/download/1.10.10/composer.phar -q &&\
1515
mv composer.phar /usr/bin/composer && \
1616
chmod +x /usr/bin/composer
1717

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Use [Redis Time Series](https://oss.redislabs.com/redistimeseries/) in PHP!
1414
### Install
1515
`composer require palicao/php-redis-time-series`
1616

17+
### Requirements
18+
The library is tested against:
19+
- PHP 7.2, 7.3 and 7.4
20+
- RedisTimeSeries 1.2.7 and 1.4.2 (but it should work with any 1.2 and 1.4 version)
21+
1722
### Construct
1823
```
1924
$ts = new TimeSeries(
@@ -118,6 +123,7 @@ See https://oss.redislabs.com/redistimeseries/commands/#tsrange.
118123
### `multiRange` and `multiRangeRaw`
119124

120125
`TimeSeries::multiRange(Filter $filter, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null): Sample[]`
126+
121127
`TimeSeries::multiRangeRaw(Filter $filter, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null): array[]`
122128

123129
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.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ services:
1111
- .:/app
1212
redis:
1313
container_name: redis
14-
image: redislabs/redistimeseries:1.2.2
14+
image: redislabs/redistimeseries:1.4.2

src/Client/RedisClient.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ private function connectIfNeeded(): void
7373
public function executeCommand(array $params)
7474
{
7575
$this->connectIfNeeded();
76+
// UNDOCUMENTED FEATURE: option 8 is REDIS_OPT_REPLY_LITERAL
77+
$value = (PHP_VERSION_ID < 70300) ? '1' : 1;
78+
$this->redis->setOption(8, $value);
7679
return $this->redis->rawCommand(...$params);
7780
}
7881
}

0 commit comments

Comments
 (0)