Skip to content

Commit 724d72f

Browse files
committed
Show key size
1 parent 810e71e commit 724d72f

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/Dashboards/APCu/APCuTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ private function viewKey(): string {
151151
'value' => $value,
152152
'type' => 'string',
153153
'ttl' => Format::seconds($ttl),
154+
'size' => Format::bytes(strlen($value)),
154155
'encode_fn' => $encode_fn,
155156
'formatted' => $is_formatted,
156157
'edit_url' => Http::queryString(['ttl'], ['form' => 'edit', 'key' => $key]),

src/Dashboards/Memcached/MemcachedTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ private function viewKey($memcached): string {
203203
'value' => $value,
204204
'type' => 'string', // In Memcache(d) everything is stored as a string.
205205
'ttl' => Format::seconds($ttl),
206+
'size' => Format::bytes(strlen($value)),
206207
'encode_fn' => $encode_fn,
207208
'formatted' => $is_formatted,
208209
'edit_url' => Http::queryString(['ttl'], ['form' => 'edit', 'key' => $key]),

src/Dashboards/Redis/RedisTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ private function viewKey(Redis $redis): string {
315315
'value' => $value,
316316
'type' => $type,
317317
'ttl' => Format::seconds($ttl),
318+
'size' => Format::bytes($redis->rawCommand('MEMORY', 'usage', $key)),
318319
'encode_fn' => $encode_fn,
319320
'formatted' => $is_formatted,
320321
'add_subkey_url' => Http::queryString(['db'], ['form' => 'new', 'key' => $key]),

templates/partials/view_key.twig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
</span>
1818
{% endif %}
1919

20+
{% if size %}
21+
<span>
22+
Size
23+
{{ include('components/badge.twig', {
24+
text: size,
25+
pill: true,
26+
class: 'font-bold',
27+
bg: 'bg-sky-500',
28+
}) }}
29+
</span>
30+
{% endif %}
31+
2032
{% if encode_fn %}
2133
<span>Encoded with {{ include('components/badge.twig', {text: encode_fn, pill: true, class: 'uppercase font-bold', bg: 'bg-blue-500'}) }}</span>
2234
{% set encode_url = '&encoder=' ~ encode_fn %}

0 commit comments

Comments
 (0)