Skip to content

Commit 1fccd35

Browse files
committed
Update RedisTrait.php
1 parent 3966f6e commit 1fccd35

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/Dashboards/Redis/RedisTrait.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -366,17 +366,14 @@ private function keysTableView(array $keys): array {
366366
$pipeline = $this->redis->pipelineKeys($keys_array);
367367

368368
foreach ($keys_array as $key) {
369-
$ttl = $pipeline[$key]['ttl'];
370-
$total = $pipeline[$key]['count'];
371-
372369
$formatted_keys[] = [
373370
'key' => $key,
374371
'base64' => true,
375372
'info' => [
376-
'link_title' => ($total !== null ? '('.$total.' items) ' : '').$key,
373+
'link_title' => ($pipeline[$key]['count'] !== null ? '('.$pipeline[$key]['count'].' items) ' : '').$key,
377374
'bytes_size' => $pipeline[$key]['size'],
378375
'type' => $pipeline[$key]['type'],
379-
'ttl' => $ttl === -1 ? 'Doesn\'t expire' : $ttl,
376+
'ttl' => $pipeline[$key]['ttl'] === -1 ? 'Doesn\'t expire' : $pipeline[$key]['ttl'],
380377
],
381378
];
382379
}
@@ -405,23 +402,19 @@ private function keysTreeView(array $keys): array {
405402
$current = &$tree;
406403
$path = '';
407404

408-
foreach ($parts as $i => $p_value) {
409-
$part = $p_value;
405+
foreach ($parts as $i => $part) {
410406
$path = $path ? $path.$separator.$part : $part;
411407

412-
if ($i === count($parts) - 1) {
413-
$ttl = $pipeline[$key]['ttl'];
414-
$total = $pipeline[$key]['count'];
415-
408+
if ($i === count($parts) - 1) { // check last part
416409
$current[] = [
417410
'type' => 'key',
418-
'name' => ($total !== null ? '('.$total.' items) ' : '').$part,
411+
'name' => ($pipeline[$key]['count'] !== null ? '('.$pipeline[$key]['count'].' items) ' : '').$part,
419412
'key' => $key,
420413
'base64' => true,
421414
'info' => [
422415
'bytes_size' => $pipeline[$key]['size'],
423416
'type' => $pipeline[$key]['type'],
424-
'ttl' => $ttl === -1 ? 'Doesn\'t expire' : $ttl,
417+
'ttl' => $pipeline[$key]['ttl'] === -1 ? 'Doesn\'t expire' : $pipeline[$key]['ttl'],
425418
],
426419
];
427420
} else {

0 commit comments

Comments
 (0)