-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat:rtc can intercept more command #3033
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
Closed
pro-spild
wants to merge
2
commits into
OpenAtomFoundation:unstable
from
pro-spild:unstable--feature--support-more-rtc-command
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,12 +258,41 @@ void PikaClientConn::ProcessMonitor(const PikaCmdArgsType& argv) { | |
| } | ||
|
|
||
| bool PikaClientConn::IsInterceptedByRTC(std::string& opt) { | ||
| // currently we only Intercept: Get, HGet | ||
| if (opt == kCmdNameGet && g_pika_conf->GetCacheString()) { | ||
| return true; | ||
| // only single key read command will be intercepted | ||
| std::shared_ptr<Cmd> c_ptr = g_pika_cmd_table_manager->GetCmd(opt); | ||
| if (!c_ptr) { | ||
| return false; | ||
| } | ||
| if (opt == kCmdNameHGet && g_pika_conf->GetCacheHash()) { | ||
| return true; | ||
|
|
||
| if (c_ptr->IsNeedReadCache()) { | ||
| if (c_ptr->flag_ & kCmdFlagsOperateKey) { | ||
| return true; | ||
| } | ||
| if (c_ptr->flag_ & kCmdFlagsKv) { | ||
| if (g_pika_conf->GetCacheString()) { | ||
| return true; | ||
| } | ||
| } else if (c_ptr->flag_ & kCmdFlagsZset) { | ||
| if (g_pika_conf->GetCacheZset()) { | ||
| return true; | ||
| } | ||
| } else if (c_ptr->flag_ & kCmdFlagsHash) { | ||
| if (g_pika_conf->GetCacheHash()) { | ||
| return true; | ||
| } | ||
| } else if (c_ptr->flag_ & kCmdFlagsList) { | ||
| if (g_pika_conf->GetCacheList()) { | ||
| return true; | ||
| } | ||
| } else if (c_ptr->flag_ & kCmdFlagsBit) { | ||
| if (g_pika_conf->GetCacheBit()) { | ||
| return true; | ||
| } | ||
| }else if (c_ptr->flag_ & kCmdFlagsSet) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 代码缩进调整一下
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里正确的缩进格式应该是什么? |
||
| if (g_pika_conf->GetCacheSet()) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
@@ -349,7 +378,7 @@ bool PikaClientConn::ReadCmdInCache(const net::RedisCmdArgsType& argv, const std | |
| } | ||
| // Initial | ||
| c_ptr->Initial(argv, current_db_); | ||
| // dont store cmd with too large key(only Get/HGet cmd can reach here) | ||
| // dont store cmd with too large key | ||
| // the cmd with large key should be non-exist in cache, except for pre-stored | ||
| if (c_ptr->IsTooLargeKey(g_pika_conf->max_key_size_in_cache())) { | ||
| resp_num--; | ||
|
|
@@ -365,7 +394,7 @@ bool PikaClientConn::ReadCmdInCache(const net::RedisCmdArgsType& argv, const std | |
| // acl check failed | ||
| return false; | ||
| } | ||
| // only read command(Get, HGet) will reach here, no need of record lock | ||
| // only read command will reach here, no need of record lock | ||
| bool read_status = c_ptr->DoReadCommandInCache(); | ||
| auto cmdstat_map = g_pika_cmd_table_manager->GetCommandStatMap(); | ||
| resp_num--; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
为什么 RTC 只能操作单个键
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.
sorry,没有这个限制,已删除这个注释