diff --git a/src/server/server_family.cc b/src/server/server_family.cc index cc7da460a12f..2c57015c5d30 100644 --- a/src/server/server_family.cc +++ b/src/server/server_family.cc @@ -541,6 +541,14 @@ void ClientCaching(CmdArgList args, ConnectionContext* cntx) { cntx->SendOk(); } +void ClientId(CmdArgList args, ConnectionContext* cntx) { + if (args.size() != 0) { + return cntx->SendError(kSyntaxErr); + } + + return cntx->SendLong(cntx->conn()->GetClientId()); +} + void ClientKill(CmdArgList args, absl::Span listeners, ConnectionContext* cntx) { std::function evaluator; @@ -1762,6 +1770,8 @@ void ServerFamily::Client(CmdArgList args, ConnectionContext* cntx) { return ClientKill(sub_args, absl::MakeSpan(listeners_), cntx); } else if (sub_cmd == "CACHING") { return ClientCaching(sub_args, cntx); + } else if (sub_cmd == "ID") { + return ClientId(sub_args, cntx); } if (sub_cmd == "SETINFO") {