Skip to content

Commit

Permalink
Move symfony apcu polyfil to dev dependencies (#68)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Kämmerling <[email protected]>
  • Loading branch information
LKaemmerling authored Sep 14, 2021
1 parent 4b9f0d0 commit 6e30c28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/Prometheus/Storage/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,15 @@ 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);
$json = json_encode($this->encodeLabelValues($data['labelValues']));
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;
Expand Down

0 comments on commit 6e30c28

Please sign in to comment.