MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / remote_get

Function remote_get

cache/cache.cpp:33–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33static bool remote_get(const string &key, string &value, redisContext *ctx) {
34 assert(ctx);
35 redisReply *reply = (redisReply *)redisCommand(ctx, "GET %s", key.data());
36 if (!reply || ctx->err) {
37 cerr << "Redis error in remote_get: " << ctx->errstr << "\n";
38 exit(-1);
39 }
40 if (reply->type == REDIS_REPLY_NIL) {
41 // not found
42 freeReplyObject(reply);
43 return false;
44 } else if (reply->type == REDIS_REPLY_STRING) {
45 // found
46 value = reply->str;
47 freeReplyObject(reply);
48 return true;
49 } else {
50 cerr << "Redis protocol error in remote_get, didn't expect reply type "
51 << redis_reply_string(reply->type) << "\n";
52 exit(-1);
53 }
54}
55
56static void remote_set(const string &key, const string &value, redisContext *ctx) {
57 assert(ctx);

Callers 2

lookupMethod · 0.85
CacheMethod · 0.85

Calls 1

redis_reply_stringFunction · 0.85

Tested by

no test coverage detected