Skip to content

Commit 61a0813

Browse files
committed
add RTC command
1 parent 6d4b8d7 commit 61a0813

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

src/pika_client_conn.cc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,29 @@ void PikaClientConn::ProcessMonitor(const PikaCmdArgsType& argv) {
273273
}
274274

275275
bool PikaClientConn::IsInterceptedByRTC(std::string& opt) {
276-
// currently we only Intercept: Get, HGet
277-
if (opt == kCmdNameGet && g_pika_conf->GetCacheString()) {
276+
277+
static const std::unordered_set<std::string> intercepted_string_cmds = {
278+
kCmdNameGet, kCmdNameStrlen, kCmdNameTtl
279+
};
280+
281+
static const std::unordered_set<std::string> intercepted_hash_cmds = {
282+
kCmdNameHGet, kCmdNameHMget, kCmdNameHExists, kCmdNameHVals, kCmdNameHStrlen
283+
};
284+
285+
static const std::unordered_set<std::string> intercepted_list_cmds = {
286+
kCmdNameLLen
287+
};
288+
289+
if (intercepted_string_cmds.count(opt) && g_pika_conf->GetCacheString()) {
278290
return true;
279291
}
280-
if (opt == kCmdNameHGet && g_pika_conf->GetCacheHash()) {
292+
if (intercepted_hash_cmds.count(opt) && g_pika_conf->GetCacheHash()) {
281293
return true;
282294
}
295+
if (intercepted_list_cmds.count(opt) && g_pika_conf->GetCacheList()) {
296+
return true;
297+
}
298+
283299
return false;
284300
}
285301

0 commit comments

Comments
 (0)