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

Method WatchKey

src/server/server.cc:2184–2198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2182}
2183
2184void Server::WatchKey(redis::Connection *conn, const std::vector<std::string> &keys) {
2185 std::unique_lock lock(watched_key_mutex_);
2186
2187 for (const auto &key : keys) {
2188 if (auto iter = watched_key_map_.find(key); iter != watched_key_map_.end()) {
2189 iter->second.emplace(conn);
2190 } else {
2191 watched_key_map_.emplace(key, std::set<redis::Connection *>{conn});
2192 }
2193
2194 conn->watched_keys.insert(key);
2195 }
2196
2197 watched_key_size_ = watched_key_map_.size();
2198}
2199
2200bool Server::IsWatchedKeysModified(redis::Connection *conn) { return conn->watched_keys_modified; }
2201

Callers 1

ExecuteMethod · 0.80

Calls 1

endMethod · 0.80

Tested by

no test coverage detected