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

Method Execute

src/commands/cmd_server.cc:1054–1066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1052class CommandRandomKey : public Commander {
1053 public:
1054 Status Execute(engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
1055 std::string key;
1056 auto cursor = srv->GetLastRandomKeyCursor();
1057 redis::Database redis(srv->storage, conn->GetNamespace());
1058
1059 auto s = redis.RandomKey(ctx, cursor, &key);
1060 if (!s.ok()) {
1061 return {Status::RedisExecErr, s.ToString()};
1062 }
1063 srv->SetLastRandomKeyCursor(key);
1064 *output = redis::BulkString(key);
1065 return Status::OK();
1066 }
1067};
1068
1069class CommandCompact : public Commander {

Callers

nothing calls this directly

Calls 6

BulkStringFunction · 0.85
RandomKeyMethod · 0.80
GetNamespaceMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected