Skip to content
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

Closed
wants to merge 3 commits into from
Closed

feat: add Rename Command #2453

wants to merge 3 commits into from

Conversation

Mixficsol
Copy link
Collaborator

fix: #2452

…mission judgment after the default user is connected (#2449)
@github-actions github-actions bot added ✏️ Feature New feature or request Invalid PR Title labels Mar 6, 2024
@Mixficsol Mixficsol changed the title feature: Add Rename Command feat: add Rename Command Mar 6, 2024
@Mixficsol Mixficsol added the 3.5.3 label Mar 6, 2024
@Mixficsol Mixficsol closed this Mar 6, 2024
@@ -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;
Copy link
Collaborator

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法用 GetConfStrMulti 替换

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法获取的结果不符合预期

image

@@ -50,6 +50,14 @@ void PikaCmdTableManager::InitCmdTable(void) {
}
}

void PikaCmdTableManager::RenameCommand(const std::string before, const std::string after) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将 before 转为小写字母,再处理

Copy link
Collaborator

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
image

另外,如果 before cmd 不存在,直接返回错误,让用户去修改配置文件

@Mixficsol Mixficsol deleted the add_rename_command branch March 14, 2024 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.5.3 ✏️ Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Rename Command
3 participants