Skip to content

Commit a2e80b0

Browse files
committed
Update RedisTrait.php
1 parent c03e2d6 commit a2e80b0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/Dashboards/Redis/RedisTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,14 @@ private function viewKey($redis): string {
288288

289289
$ttl = $redis->ttl($key);
290290

291+
$size = $redis->rawCommand('MEMORY', 'usage', $key); // requires Redis >= 4.0.0
292+
291293
return $this->template->render('partials/view_key', [
292294
'key' => $key,
293295
'value' => $value,
294296
'type' => $type,
295297
'ttl' => Format::seconds($ttl),
296-
'size' => Format::bytes($redis->rawCommand('MEMORY', 'usage', $key)),
298+
'size' => is_int($size) ? Format::bytes($size) : null,
297299
'encode_fn' => $encode_fn,
298300
'formatted' => $is_formatted,
299301
'add_subkey_url' => Http::queryString(['db'], ['form' => 'new', 'key' => $key]),

0 commit comments

Comments
 (0)