@@ -335,9 +335,7 @@ private function form(): string {
335335 * @throws Exception
336336 */
337337 private function getAllKeys (): array {
338- static $ keys = [];
339338 $ filter = Http::get ('s ' , '* ' );
340-
341339 $ this ->template ->addGlobal ('search_value ' , $ filter );
342340
343341 if (isset ($ this ->servers [$ this ->current_server ]['scansize ' ])) {
@@ -346,6 +344,23 @@ private function getAllKeys(): array {
346344 $ keys_array = $ this ->redis ->keys ($ filter );
347345 }
348346
347+ return array_map (static fn ($ key ): array => ['key ' => $ key ], $ keys_array );
348+ }
349+
350+ /**
351+ * @param array<int|string, mixed> $paginated_keys
352+ *
353+ * @return array<int, array<string, string|int>>
354+ *
355+ * @throws Exception
356+ */
357+ private function formatTableKeys (array $ paginated_keys ): array {
358+ if ($ paginated_keys === []) {
359+ return [];
360+ }
361+
362+ $ keys = [];
363+ $ keys_array = array_column ($ paginated_keys , 'key ' );
349364 $ pipeline = $ this ->redis ->pipelineKeys ($ keys_array );
350365
351366 foreach ($ keys_array as $ key ) {
@@ -364,9 +379,7 @@ private function getAllKeys(): array {
364379 ];
365380 }
366381
367- $ keys = Helpers::sortKeys ($ this ->template , $ keys );
368-
369- return $ keys ;
382+ return Helpers::sortKeys ($ this ->template , $ keys );
370383 }
371384
372385 /**
@@ -466,9 +479,11 @@ function (string $key, string $value, int $ttl): bool {
466479 }
467480
468481 $ paginator = new Paginator ($ this ->template , $ keys , [['s ' , 'pp ' ], ['p ' => '' ]]);
482+ $ paginated_keys = $ paginator ->getPaginated ();
483+ $ paginated = $ this ->formatTableKeys ($ paginated_keys );
469484
470485 return $ this ->template ->render ('dashboards/redis/redis ' , [
471- 'keys ' => $ paginator -> getPaginated () ,
486+ 'keys ' => $ paginated ,
472487 'all_keys ' => $ this ->redis ->dbSize (),
473488 'paginator ' => $ paginator ->render (),
474489 'view_key ' => Http::queryString (['s ' ], ['view ' => 'key ' , 'key ' => '__key__ ' ]),
0 commit comments