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;