infdahai commented on code in PR #1444:
URL:
https://github.com/apache/incubator-kvrocks/pull/1444#discussion_r1198068036
##########
src/commands/cmd_set.cc:
##########
@@ -283,6 +285,46 @@ class CommandSInter : public Commander {
}
};
+class CommandSInterCard : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ auto parse_numkey = ParseInt<int>(args[1], 10);
+ if (!parse_numkey) {
+ return {Status::RedisParseErr, errValueNotInteger};
+ }
+ numkeys_ = *parse_numkey;
+
+ // command: SINTERCARD 2 key1 key2 LIMIT 1
+ if (args.size() == numkeys_ + 4) {
+ auto parse_limit = ParseInt<int>(args[numkeys_ + 2], 10);
+ if (!parse_limit) {
+ return {Status::RedisParseErr, errValueNotInteger};
+ }
+ limit_ = std::max(0, *parse_limit);
+ }
+ return Commander::Parse(args);
+ }
+
+ Status Execute(Server *svr, Connection *conn, std::string *output) override {
+ std::vector<Slice> keys;
+ for (size_t i = 2; i < numkeys_ + 2; i++) {
+ keys.emplace_back(args_[i]);
+ }
+
+ redis::Set set_db(svr->storage, conn->GetNamespace());
+ int ret = 0;
Review Comment:
> You don't use this ret variable
yeah, I fix it now.
> the go-redis package's version is v9.0.0-beta.2 in the project so it
doesn't support this command
So we should wait for updating the go-redis package and then write go tests.
##########
src/commands/cmd_set.cc:
##########
@@ -283,6 +285,46 @@ class CommandSInter : public Commander {
}
};
+class CommandSInterCard : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ auto parse_numkey = ParseInt<int>(args[1], 10);
+ if (!parse_numkey) {
+ return {Status::RedisParseErr, errValueNotInteger};
+ }
+ numkeys_ = *parse_numkey;
+
+ // command: SINTERCARD 2 key1 key2 LIMIT 1
+ if (args.size() == numkeys_ + 4) {
+ auto parse_limit = ParseInt<int>(args[numkeys_ + 2], 10);
+ if (!parse_limit) {
+ return {Status::RedisParseErr, errValueNotInteger};
+ }
+ limit_ = std::max(0, *parse_limit);
+ }
+ return Commander::Parse(args);
+ }
+
+ Status Execute(Server *svr, Connection *conn, std::string *output) override {
+ std::vector<Slice> keys;
+ for (size_t i = 2; i < numkeys_ + 2; i++) {
+ keys.emplace_back(args_[i]);
+ }
+
+ redis::Set set_db(svr->storage, conn->GetNamespace());
+ int ret = 0;
Review Comment:
> You don't use this ret variable
yeah, I add it now.
> the go-redis package's version is v9.0.0-beta.2 in the project so it
doesn't support this command
So we should wait for updating the go-redis package and then write go tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]