-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Rename Command #2453
feat: add Rename Command #2453
Conversation
…mission judgment after the default user is connected (#2449)
@@ -50,7 +50,7 @@ class BaseConf { | |||
bool GetConfIntHuman(const std::string& name, int* value) const; | |||
bool GetConfInt64(const std::string& name, int64_t* value) const; | |||
bool GetConfInt64Human(const std::string& name, int64_t* value) const; | |||
|
|||
bool GetConfStr(const std::string& name, std::vector<std::string>* values) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里直接使用 GetConfStrMulti 方法,直接获取一个数组
@@ -178,6 +178,19 @@ bool BaseConf::GetConfStr(const std::string& name, std::string* val) const { | |||
return false; | |||
} | |||
|
|||
bool BaseConf::GetConfStr(const std::string& name, std::vector<std::string>* values) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法用 GetConfStrMulti 替换
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -50,6 +50,14 @@ void PikaCmdTableManager::InitCmdTable(void) { | |||
} | |||
} | |||
|
|||
void PikaCmdTableManager::RenameCommand(const std::string before, const std::string after) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
将 before 转为小写字母,再处理
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑 after 为 "" 的情况,比如在 conf 文件里面配置的 hget:
rename-command : hget
rename-command : set 360set
redis 里面会先把命令删除了:https://github.com/redis/redis/blob/unstable/src/config.c
另外,如果 before cmd 不存在,直接返回错误,让用户去修改配置文件
fix: #2452