zyearn commented on a change in pull request #1128:
URL: https://github.com/apache/incubator-brpc/pull/1128#discussion_r435052914
##########
File path: src/brpc/redis.cpp
##########
@@ -437,19 +437,21 @@ std::ostream& operator<<(std::ostream& os, const
RedisResponse& response) {
}
bool RedisService::AddCommandHandler(const std::string& name,
RedisCommandHandler* handler) {
- std::string lcname = StringToLowerASCII(name);
- auto it = _command_map.find(lcname);
+ butil::StringPiece name_piece(name);
+ auto it = _command_map.find(name_piece);
if (it != _command_map.end()) {
LOG(ERROR) << "redis command name=" << name << " exist";
return false;
}
- _command_map[lcname] = handler;
+
+ _all_commands.push_back(name);
+ name_piece = _all_commands.back();
+ _command_map[name_piece] = handler;
return true;
}
-RedisCommandHandler* RedisService::FindCommandHandler(const std::string& name)
const {
- std::string lcname = StringToLowerASCII(name);
- auto it = _command_map.find(lcname);
+RedisCommandHandler* RedisService::FindCommandHandler(const
butil::StringPiece& name) const {
+ auto it = _command_map.find(name);
Review comment:
这里的StringToLowerASCII好像漏掉了
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]