From 6e30c28d19acb65e5d9a445c8c9bdb11b0d56c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Tue, 14 Sep 2021 07:39:00 +0200 Subject: [PATCH] Move symfony apcu polyfil to dev dependencies (#68) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lukas Kämmerling --- composer.json | 9 +++++---- src/Prometheus/Storage/Redis.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 89850b13..85b1477b 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,7 @@ }, "require": { "php": "^7.2|^8.0", - "ext-json": "*", - "symfony/polyfill-apcu": "^1.6" + "ext-json": "*" }, "require-dev": { "guzzlehttp/guzzle": "^6.3|^7.0", @@ -26,12 +25,14 @@ "phpstan/phpstan-phpunit": "^0.12.16", "phpstan/phpstan-strict-rules": "^0.12.5", "phpunit/phpunit": "^8.4|^9.4", - "squizlabs/php_codesniffer": "^3.5" + "squizlabs/php_codesniffer": "^3.5", + "symfony/polyfill-apcu": "^1.6" }, "suggest": { "ext-redis": "Required if using Redis.", "ext-apc": "Required if using APCu.", - "promphp/prometheus_push_gateway_php": "An easy client for using Prometheus PushGateway." + "promphp/prometheus_push_gateway_php": "An easy client for using Prometheus PushGateway.", + "symfony/polyfill-apcu": "Required if you use APCu on PHP8.0+" }, "autoload": { "psr-4": { diff --git a/src/Prometheus/Storage/Redis.php b/src/Prometheus/Storage/Redis.php index d05ef8f4..19d0110f 100644 --- a/src/Prometheus/Storage/Redis.php +++ b/src/Prometheus/Storage/Redis.php @@ -285,7 +285,7 @@ public function updateSummary(array $data): void if (false === $json) { throw new RuntimeException(json_last_error_msg()); } - $this->redis->setnx($metaKey, $json); + $this->redis->setNx($metaKey, $json); // store value key $valueKey = $summaryKey . ':' . $this->valueKey($data); @@ -293,7 +293,7 @@ public function updateSummary(array $data): void if (false === $json) { throw new RuntimeException(json_last_error_msg()); } - $this->redis->setnx($valueKey, $json); + $this->redis->setNx($valueKey, $json); // trick to handle uniqid collision $done = false;