@@ -331,29 +331,21 @@ public function saveKey(): void {
331331 $ key = Http::post ('key ' , '' );
332332 $ value = Value::converter (Http::post ('value ' , '' ), Http::post ('encoder ' , '' ), 'save ' );
333333 $ old_value = Http::post ('old_value ' , '' );
334- $ type = Http::post ('redis_type ' , '' );
334+ $ type = Http::post ('rtype ' , '' );
335335 $ old_key = Http::post ('old_key ' , '' );
336336
337337 if ($ old_key !== '' && $ old_key !== $ key ) { // @phpstan-ignore-line
338338 $ this ->redis ->rename ($ old_key , $ key );
339339 }
340340
341341 $ this ->store ($ type , $ key , $ value , $ old_value , [
342- 'list_index ' => $ _POST ['index ' ] ?? '' ,
343- 'zset_score ' => Http::post ('score ' , 0 ),
344- 'hash_key ' => Http::post ('hash_key ' , '' ),
345- 'stream_id ' => Http::post ('stream_id ' , '* ' ),
346- 'stream_field ' => Http::post ('field ' , '' ),
342+ 'list_index ' => $ _POST ['index ' ] ?? '' ,
343+ 'zset_score ' => Http::post ('score ' , 0 ),
344+ 'hash_key ' => Http::post ('hash_key ' , '' ),
345+ 'stream_id ' => Http::post ('stream_id ' , '* ' ),
346+ 'ttl ' => Http::post ('expire ' , 0 ),
347347 ]);
348348
349- $ expire = Http::post ('expire ' , 0 );
350-
351- if ($ expire === -1 ) {
352- $ this ->redis ->persist ($ key );
353- } else {
354- $ this ->redis ->expire ($ key , $ expire );
355- }
356-
357349 Http::redirect ([], ['view ' => 'key ' , 'key ' => $ key ]);
358350 }
359351
@@ -364,13 +356,14 @@ public function saveKey(): void {
364356 */
365357 private function form (): string {
366358 $ key = (string ) Http::get ('key ' , Http::post ('key ' , '' ));
367- $ type = Http::post ('redis_type ' , 'string ' );
359+ $ type = Http::post ('rtype ' , 'string ' );
368360 $ index = $ _POST ['index ' ] ?? '' ;
369361 $ score = Http::post ('score ' , 0 );
370362 $ hash_key = Http::post ('hash_key ' , '' );
371363 $ expire = Http::post ('expire ' , -1 );
372364 $ encoder = Http::get ('encoder ' , 'none ' );
373365 $ value = Http::post ('value ' , '' );
366+ $ stream_id = Http::post ('stream_id ' , '* ' );
374367
375368 if (isset ($ _POST ['submit ' ])) {
376369 $ this ->saveKey ();
@@ -395,16 +388,17 @@ private function form(): string {
395388 $ value = Value::converter ($ value , $ encoder , 'view ' );
396389
397390 return $ this ->template ->render ('dashboards/redis/form ' , [
398- 'key ' => $ key ,
399- 'value ' => $ value ,
400- 'types ' => $ this ->getAllTypes (),
401- 'type ' => $ type ,
402- 'index ' => $ index ,
403- 'score ' => $ score ,
404- 'hash_key ' => $ hash_key ,
405- 'expire ' => $ expire ,
406- 'encoders ' => Config::getEncoders (),
407- 'encoder ' => $ encoder ,
391+ 'key ' => $ key ,
392+ 'value ' => $ value ,
393+ 'types ' => $ this ->getAllTypes (),
394+ 'type ' => $ type ,
395+ 'index ' => $ index ,
396+ 'score ' => $ score ,
397+ 'hash_key ' => $ hash_key ,
398+ 'expire ' => $ expire ,
399+ 'encoders ' => Config::getEncoders (),
400+ 'encoder ' => $ encoder ,
401+ 'stream_id ' => $ stream_id ,
408402 ]);
409403 }
410404
0 commit comments