@@ -97,8 +97,8 @@ public static function setPrefix(string $prefix): void
97
97
}
98
98
99
99
/**
100
- * @deprecated use replacement method wipeStorage from Adapter interface
101
100
* @throws StorageException
101
+ * @deprecated use replacement method wipeStorage from Adapter interface
102
102
*/
103
103
public function flushRedis (): void
104
104
{
@@ -230,11 +230,11 @@ private function connectToServer(): void
230
230
if ($ this ->options ['persistent_connections ' ] !== false ) {
231
231
$ connection_successful = $ this ->redis ->pconnect (
232
232
$ this ->options ['host ' ],
233
- (int ) $ this ->options ['port ' ],
234
- (float ) $ this ->options ['timeout ' ]
233
+ (int )$ this ->options ['port ' ],
234
+ (float )$ this ->options ['timeout ' ]
235
235
);
236
236
} 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 ' ]);
238
238
}
239
239
if (!$ connection_successful ) {
240
240
throw new StorageException (
@@ -306,15 +306,17 @@ public function updateSummary(array $data): void
306
306
if (false === $ json ) {
307
307
throw new RuntimeException (json_last_error_msg ());
308
308
}
309
- $ this ->redis ->setNx ($ metaKey , $ json ); /** @phpstan-ignore-line */
309
+ $ this ->redis ->setNx ($ metaKey , $ json );
310
+ /** @phpstan-ignore-line */
310
311
311
312
// store value key
312
313
$ valueKey = $ summaryKey . ': ' . $ this ->valueKey ($ data );
313
314
$ json = json_encode ($ this ->encodeLabelValues ($ data ['labelValues ' ]));
314
315
if (false === $ json ) {
315
316
throw new RuntimeException (json_last_error_msg ());
316
317
}
317
- $ this ->redis ->setNx ($ valueKey , $ json ); /** @phpstan-ignore-line */
318
+ $ this ->redis ->setNx ($ valueKey , $ json );
319
+ /** @phpstan-ignore-line */
318
320
319
321
// trick to handle uniqid collision
320
322
$ done = false ;
@@ -414,7 +416,7 @@ private function collectHistograms(): array
414
416
sort ($ keys );
415
417
$ histograms = [];
416
418
foreach ($ keys as $ key ) {
417
- $ raw = $ this ->redis ->hGetAll (str_replace ( $ this ->redis ->_prefix ('' ), '' , $ key ));
419
+ $ raw = $ this ->redis ->hGetAll (ltrim ( $ key , $ this ->redis ->_prefix ('' )));
418
420
if (!isset ($ raw ['__meta ' ])) {
419
421
continue ;
420
422
}
@@ -546,7 +548,7 @@ private function collectSummaries(): array
546
548
$ sampleValues = $ this ->redis ->keys ($ summaryKey . ': ' . $ metaData ['name ' ] . ': ' . $ encodedLabelValues . ':value:* ' );
547
549
foreach ($ sampleValues as $ sampleValueWithPrefix ) {
548
550
$ sampleValue = $ this ->removePrefixFromKey ($ sampleValueWithPrefix );
549
- $ samples [] = (float ) $ this ->redis ->get ($ sampleValue );
551
+ $ samples [] = (float )$ this ->redis ->get ($ sampleValue );
550
552
}
551
553
552
554
if (count ($ samples ) === 0 ) {
@@ -608,7 +610,7 @@ private function collectGauges(bool $sortMetrics = true): array
608
610
sort ($ keys );
609
611
$ gauges = [];
610
612
foreach ($ keys as $ key ) {
611
- $ raw = $ this ->redis ->hGetAll (str_replace ( $ this ->redis ->_prefix ('' ), '' , $ key ));
613
+ $ raw = $ this ->redis ->hGetAll (ltrim ( $ key , $ this ->redis ->_prefix ('' )));
612
614
if (!isset ($ raw ['__meta ' ])) {
613
615
continue ;
614
616
}
@@ -648,7 +650,7 @@ private function collectCounters(bool $sortMetrics = true): array
648
650
sort ($ keys );
649
651
$ counters = [];
650
652
foreach ($ keys as $ key ) {
651
- $ raw = $ this ->redis ->hGetAll (str_replace ( $ this ->redis ->_prefix ('' ), '' , $ key ));
653
+ $ raw = $ this ->redis ->hGetAll (ltrim ( $ key , $ this ->redis ->_prefix ('' )));
652
654
if (!isset ($ raw ['__meta ' ])) {
653
655
continue ;
654
656
}
0 commit comments