| 1052 | class 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 | |
| 1069 | class CommandCompact : public Commander { |
nothing calls this directly
no test coverage detected