@@ -97,8 +97,8 @@ public static function setPrefix(string $prefix): void
9797 }
9898
9999 /**
100- * @deprecated use replacement method wipeStorage from Adapter interface
101100 * @throws StorageException
101+ * @deprecated use replacement method wipeStorage from Adapter interface
102102 */
103103 public function flushRedis (): void
104104 {
@@ -230,11 +230,11 @@ private function connectToServer(): void
230230 if ($ this ->options ['persistent_connections ' ] !== false ) {
231231 $ connection_successful = $ this ->redis ->pconnect (
232232 $ this ->options ['host ' ],
233- (int ) $ this ->options ['port ' ],
234- (float ) $ this ->options ['timeout ' ]
233+ (int )$ this ->options ['port ' ],
234+ (float )$ this ->options ['timeout ' ]
235235 );
236236 } else {
237- $ connection_successful = $ this ->redis ->connect ($ this ->options ['host ' ], (int ) $ this ->options ['port ' ], (float ) $ this ->options ['timeout ' ]);
237+ $ connection_successful = $ this ->redis ->connect ($ this ->options ['host ' ], (int )$ this ->options ['port ' ], (float )$ this ->options ['timeout ' ]);
238238 }
239239 if (!$ connection_successful ) {
240240 throw new StorageException (
@@ -306,15 +306,16 @@ public function updateSummary(array $data): void
306306 if (false === $ json ) {
307307 throw new RuntimeException (json_last_error_msg ());
308308 }
309- $ this ->redis ->setNx ($ metaKey , $ json ); /** @phpstan-ignore-line */
309+ $ this ->redis ->setNx ($ metaKey , $ json );/** @phpstan-ignore-line */
310+
310311
311312 // store value key
312313 $ valueKey = $ summaryKey . ': ' . $ this ->valueKey ($ data );
313314 $ json = json_encode ($ this ->encodeLabelValues ($ data ['labelValues ' ]));
314315 if (false === $ json ) {
315316 throw new RuntimeException (json_last_error_msg ());
316317 }
317- $ this ->redis ->setNx ($ valueKey , $ json ); /** @phpstan-ignore-line */
318+ $ this ->redis ->setNx ($ valueKey , $ json );/** @phpstan-ignore-line */
318319
319320 // trick to handle uniqid collision
320321 $ done = false ;
@@ -414,7 +415,7 @@ private function collectHistograms(): array
414415 sort ($ keys );
415416 $ histograms = [];
416417 foreach ($ keys as $ key ) {
417- $ raw = $ this ->redis ->hGetAll (str_replace ( $ this ->redis ->_prefix ('' ), '' , $ key ));
418+ $ raw = $ this ->redis ->hGetAll (ltrim ( $ key , $ this ->redis ->_prefix ('' )));
418419 if (!isset ($ raw ['__meta ' ])) {
419420 continue ;
420421 }
@@ -546,7 +547,7 @@ private function collectSummaries(): array
546547 $ sampleValues = $ this ->redis ->keys ($ summaryKey . ': ' . $ metaData ['name ' ] . ': ' . $ encodedLabelValues . ':value:* ' );
547548 foreach ($ sampleValues as $ sampleValueWithPrefix ) {
548549 $ sampleValue = $ this ->removePrefixFromKey ($ sampleValueWithPrefix );
549- $ samples [] = (float ) $ this ->redis ->get ($ sampleValue );
550+ $ samples [] = (float )$ this ->redis ->get ($ sampleValue );
550551 }
551552
552553 if (count ($ samples ) === 0 ) {
@@ -608,7 +609,7 @@ private function collectGauges(bool $sortMetrics = true): array
608609 sort ($ keys );
609610 $ gauges = [];
610611 foreach ($ keys as $ key ) {
611- $ raw = $ this ->redis ->hGetAll (str_replace ( $ this ->redis ->_prefix ('' ), '' , $ key ));
612+ $ raw = $ this ->redis ->hGetAll (ltrim ( $ key , $ this ->redis ->_prefix ('' )));
612613 if (!isset ($ raw ['__meta ' ])) {
613614 continue ;
614615 }
@@ -648,7 +649,7 @@ private function collectCounters(bool $sortMetrics = true): array
648649 sort ($ keys );
649650 $ counters = [];
650651 foreach ($ keys as $ key ) {
651- $ raw = $ this ->redis ->hGetAll (str_replace ( $ this ->redis ->_prefix ('' ), '' , $ key ));
652+ $ raw = $ this ->redis ->hGetAll (ltrim ( $ key , $ this ->redis ->_prefix ('' )));
652653 if (!isset ($ raw ['__meta ' ])) {
653654 continue ;
654655 }
0 commit comments