File tree Expand file tree Collapse file tree 3 files changed +13
-14
lines changed
Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -151,9 +151,9 @@ public function pipelineKeys(array $keys): array {
151151 ];
152152 }
153153
154- $ type_results = $ this ->pipeline (function ($ pipe ) use ($ keys , $ data ): void {
154+ $ count_results = $ this ->pipeline (function ($ pipe ) use ($ keys , $ data ): void {
155155 foreach ($ keys as $ key ) {
156- $ lua_script = match ($ data [$ key ]['type ' ]) {
156+ $ lua = match ($ data [$ key ]['type ' ]) {
157157 'set ' => 'return redis.call("SCARD", KEYS[1]) ' ,
158158 'list ' => 'return redis.call("LLEN", KEYS[1]) ' ,
159159 'zset ' => 'return redis.call("ZCARD", KEYS[1]) ' ,
@@ -162,13 +162,13 @@ public function pipelineKeys(array $keys): array {
162162 default => 'return nil ' ,
163163 };
164164
165- $ pipe ->eval ($ lua_script , 1 , $ key );
165+ $ pipe ->eval ($ lua , 1 , $ key );
166166 }
167167 });
168168
169169 foreach ($ keys as $ i => $ key ) {
170- $ type = $ data [ $ key ][ ' type ' ] ;
171- $ data [$ key ]['count ' ] = ( $ type !== 'none ' && isset ( $ type_results [ $ i ]) && is_int ($ type_results [ $ i ])) ? $ type_results [ $ i ] : null ;
170+ $ count = $ count_results [ $ i ] ?? null ;
171+ $ data [$ key ]['count ' ] = $ data [ $ key ][ ' type ' ] !== 'none ' && is_int ($ count ) ? $ count : null ;
172172 }
173173
174174 return $ data ;
Original file line number Diff line number Diff line change @@ -171,19 +171,19 @@ public function pipelineKeys(array $keys): array {
171171 $ type = $ this ->getType ($ results [$ index + 1 ]);
172172
173173 $ count = match ($ type ) {
174- 'set ' => is_int ( $ results [$ index + 3 ]) ? $ results [ $ index + 3 ] : null ,
175- 'list ' => is_int ( $ results [$ index + 4 ]) ? $ results [ $ index + 4 ] : null ,
176- 'zset ' => is_int ( $ results [$ index + 5 ]) ? $ results [ $ index + 5 ] : null ,
177- 'hash ' => is_int ( $ results [$ index + 6 ]) ? $ results [ $ index + 6 ] : null ,
178- 'stream ' => is_int ( $ results [$ index + 7 ]) ? $ results [ $ index + 7 ] : null ,
174+ 'set ' => $ results [$ index + 3 ] ?? null ,
175+ 'list ' => $ results [$ index + 4 ] ?? null ,
176+ 'zset ' => $ results [$ index + 5 ] ?? null ,
177+ 'hash ' => $ results [$ index + 6 ] ?? null ,
178+ 'stream ' => $ results [$ index + 7 ] ?? null ,
179179 default => null ,
180180 };
181181
182182 $ data [$ key ] = [
183183 'ttl ' => $ results [$ index ],
184184 'type ' => $ type ,
185- 'size ' => is_int ( $ results [$ index + 2 ]) ? $ results [ $ index + 2 ] : 0 ,
186- 'count ' => $ count ,
185+ 'size ' => $ results [$ index + 2 ] ?? 0 ,
186+ 'count ' => is_numeric ( $ count) ? ( int ) $ count : null ,
187187 ];
188188 }
189189
Original file line number Diff line number Diff line change @@ -343,7 +343,6 @@ private function getAllKeys(): array {
343343
344344 foreach ($ keys_array as $ key ) {
345345 $ ttl = $ pipeline [$ key ]['ttl ' ];
346- $ type = $ pipeline [$ key ]['type ' ];
347346 $ total = $ pipeline [$ key ]['count ' ];
348347
349348 $ keys [] = [
@@ -352,7 +351,7 @@ private function getAllKeys(): array {
352351 'items ' => [
353352 'link_title ' => ($ total !== null ? '( ' .$ total .' items) ' : '' ).$ key ,
354353 'bytes_size ' => $ pipeline [$ key ]['size ' ],
355- 'type ' => $ type ,
354+ 'type ' => $ pipeline [ $ key ][ ' type ' ] ,
356355 'ttl ' => $ ttl === -1 ? 'Doesn \'t expire ' : $ ttl ,
357356 ],
358357 ];
You can’t perform that action at this time.
0 commit comments