@@ -588,7 +588,6 @@ class CommandHPersist : public Commander {
588588 public:
589589 Status Parse (const std::vector<std::string> &args) override {
590590 // HPERSIST key FIELDS numfields field [field ...]
591- // Minimum: HPERSIST key FIELDS 1 field = 5 args
592591 if (args.size () < 5 ) {
593592 return {Status::RedisParseErr, errWrongNumOfArguments};
594593 }
@@ -606,7 +605,6 @@ class CommandHPersist : public Commander {
606605 return {Status::RedisExecErr, s.ToString ()};
607606 }
608607
609- // Return array of results
610608 std::vector<std::string> result_strings;
611609 result_strings.reserve (results.size ());
612610 for (const auto &r : results) {
@@ -624,7 +622,6 @@ class CommandHTTL : public Commander {
624622 public:
625623 Status Parse (const std::vector<std::string> &args) override {
626624 // HTTL key FIELDS numfields field [field ...]
627- // Minimum: HTTL key FIELDS 1 field = 5 args
628625 if (args.size () < 5 ) {
629626 return {Status::RedisParseErr, errWrongNumOfArguments};
630627 }
@@ -644,9 +641,6 @@ class CommandHTTL : public Commander {
644641
645642 auto current_time_ms = static_cast <int64_t >(util::GetTimeStampMS ());
646643
647- // httl returns time in seconds, hpttl returns time in milliseconds as TTLFields
648- // hexpiretime returns expire_time in seconds, hpexpiretime returns expire_time in milliseconds as TTLFields already
649- // does
650644 for (auto &r : results) {
651645 if (r > 0 ) {
652646 if (util::EqualICase (args_[0 ], " httl" )) {
@@ -656,7 +650,6 @@ class CommandHTTL : public Commander {
656650 } else if (util::EqualICase (args_[0 ], " hexpiretime" )) {
657651 r = r / 1000 ;
658652 } else if (util::EqualICase (args_[0 ], " hpexpiretime" )) {
659- // do nothing as TTLFields already returns expire_time in milliseconds
660653 }
661654 }
662655 }
@@ -676,13 +669,13 @@ class CommandHTTL : public Commander {
676669class CommandHMSetEX : public Commander {
677670 public:
678671 Status Parse (const std::vector<std::string> &args) override {
672+ // HSETEX key [FNX | FXX] [EX seconds | PX milliseconds |
673+ // EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL]
674+ // FIELDS numfields field value [field value ...]
679675 if (args.size () < 7 ) {
680676 return {Status::RedisParseErr, errWrongNumOfArguments};
681677 }
682678
683- size_t pos = 2 ;
684-
685- // Lambda to parse expiration value with validation
686679 auto parse_expire_value = [](const std::string &value_str) -> uint64_t {
687680 auto result = ParseInt<uint64_t >(value_str, 10 );
688681 if (!result || *result <= 0 ) {
@@ -691,11 +684,11 @@ class CommandHMSetEX : public Commander {
691684 return result.GetValue ();
692685 };
693686
687+ size_t pos = 2 ;
694688 if (pos < args.size () && util::EqualICase (args[pos], std::string_view (" FIELDS" ))) {
695689 return {Status::RedisParseErr, " ERR Missing expiration option" };
696690 }
697691
698- // Parse expiration option - optional
699692 params_.expire_params .option = SetEXExpireOption::kNoExpire ;
700693 while (pos < args.size ()) {
701694 const auto &opt = args[pos];
@@ -712,11 +705,9 @@ class CommandHMSetEX : public Commander {
712705 if (params_.expire_params .option == SetEXExpireOption::kNoExpire ) {
713706 return {Status::RedisParseErr, " Invalid syntax: at least one expiration option is required before FIELDS" };
714707 } else {
715- // FIELDS is a special case and should not be treated as an expiration option
716708 break ;
717709 }
718710 } else {
719- // got next must be a integer
720711 auto value = parse_expire_value (args[pos + 1 ]);
721712 params_.expire_params .value = value;
722713 if (value == 0 ) {
@@ -736,7 +727,6 @@ class CommandHMSetEX : public Commander {
736727 pos += 2 ;
737728 }
738729 }
739- // Parse FIELDS and field-value pairs
740730 if (pos >= args.size () || !util::EqualICase (args[pos], " FIELDS" )) {
741731 return {Status::RedisParseErr, " mandatory argument FIELDS is missing" };
742732 }
@@ -755,7 +745,6 @@ class CommandHMSetEX : public Commander {
755745 auto num_fields = *num_fields_result;
756746 pos++;
757747
758- // Parse field-value pairs
759748 if (args.size () != pos + 2 * num_fields) {
760749 return {Status::RedisParseErr, " number of field-value pairs does not match numfields" };
761750 }
0 commit comments