MCPcopy Create free account
hub / github.com/cinience/RedisStudio / GetData

Method GetData

RedisStudio/Redis/RedisListModel.cpp:9–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7}
8
9bool RedisListModel::GetData( const std::string& key, RedisResult& results )
10{
11 bool retVal = false;
12 ScopedRedisReply lenreply = GetClient()->Command("LLEN %s", key.c_str());
13 if (lenreply.IsNull())
14 {
15 return false;
16 }
17 if (lenreply->type == REDIS_REPLY_INTEGER)
18 {
19 long long llen = lenreply->integer;
20 results.NewColumn("Value");
21 for (int idx=0; idx<llen; )
22 {
23 redisReply* reply = GetClient()->Command("LRANGE %s %d %d", key.c_str(), idx, idx+1000 > llen ? idx+1000 : llen - idx);
24 if (!reply) return retVal;
25
26 if (reply->type == REDIS_REPLY_ARRAY)
27 {
28 std::size_t i = 0;
29 redisReply* tmpReply ;
30 while (i < reply->elements)
31 {
32 tmpReply = reply->element[i];
33 results.NewRow();
34 string& myvalue = results.Value(results.RowSize()-1, 0);
35 myvalue.assign(tmpReply->str, tmpReply->len);
36 i++;
37 }
38 retVal = true;
39 }
40 freeReplyObject(reply);
41 idx+=1000;
42 }
43 }
44
45 return retVal;
46}
47
48bool RedisListModel::UpdateData( const std::string& key,
49 const std::string& oldValue,

Callers

nothing calls this directly

Calls 7

freeReplyObjectFunction · 0.85
CommandMethod · 0.80
NewColumnMethod · 0.80
NewRowMethod · 0.80
ValueMethod · 0.80
RowSizeMethod · 0.80
IsNullMethod · 0.45

Tested by

no test coverage detected