MCPcopy Create free account
hub / github.com/apache/kvrocks / PSubscribeChannel

Method PSubscribeChannel

src/server/server.cc:534–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534void Server::PSubscribeChannel(const std::string &pattern, redis::Connection *conn) {
535 std::lock_guard<std::mutex> guard(pubsub_channels_mu_);
536
537 auto conn_ctx = ConnContext(conn->Owner(), conn->GetFD());
538 if (auto iter = pubsub_patterns_.find(pattern); iter == pubsub_patterns_.end()) {
539 pubsub_patterns_.emplace(pattern, std::list<ConnContext>{conn_ctx});
540 } else {
541 iter->second.emplace_back(conn_ctx);
542 }
543}
544
545void Server::PUnsubscribeChannel(const std::string &pattern, redis::Connection *conn) {
546 std::lock_guard<std::mutex> guard(pubsub_channels_mu_);

Callers 1

ExecuteMethod · 0.45

Calls 4

ConnContextClass · 0.85
OwnerMethod · 0.80
GetFDMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected