Skip to content

Commit

Permalink
Insure compatibility with RedisTimeSeries 1.4.2
Browse files Browse the repository at this point in the history
also bump the default php version to 7.4
  • Loading branch information
palicao authored Aug 8, 2020
1 parent 4ab7007 commit 6139371
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
language: php
dist: bionic

php:
- 7.2
- 7.3
- 7.4

env:
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=1.2.2
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=1.2.7
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=1.4.2
- REDIS_HOST=localhost REDIS_TIMESERIES_VERSION=edge

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

script:
- composer install
Expand All @@ -35,4 +37,4 @@ script:
after_script:
- docker stop redis
- docker rm redis
- 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
- 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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.3-cli
FROM php:7.4-cli
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /app

Expand All @@ -11,7 +11,7 @@ RUN pecl install redis && \
pecl install xdebug && \
docker-php-ext-enable redis xdebug

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

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Use [Redis Time Series](https://oss.redislabs.com/redistimeseries/) in PHP!
### Install
`composer require palicao/php-redis-time-series`

### 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)

### Construct
```
$ts = new TimeSeries(
Expand Down Expand Up @@ -118,6 +123,7 @@ See https://oss.redislabs.com/redistimeseries/commands/#tsrange.
### `multiRange` and `multiRangeRaw`

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

`TimeSeries::multiRangeRaw(Filter $filter, ?DateTimeInterface $from = null, ?DateTimeInterface $to = null, ?int $count = null, ?AggregationRule $rule = null): array[]`

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.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ services:
- .:/app
redis:
container_name: redis
image: redislabs/redistimeseries:1.2.2
image: redislabs/redistimeseries:1.4.2
3 changes: 3 additions & 0 deletions src/Client/RedisClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ private function connectIfNeeded(): void
public function executeCommand(array $params)
{
$this->connectIfNeeded();
// UNDOCUMENTED FEATURE: option 8 is REDIS_OPT_REPLY_LITERAL
$value = (PHP_VERSION_ID < 70300) ? '1' : 1;
$this->redis->setOption(8, $value);
return $this->redis->rawCommand(...$params);
}
}

0 comments on commit 6139371

Please sign in to comment.