MCPcopy Create free account
hub / github.com/acl-dev/acl / test_mget

Function test_mget

lib_acl_cpp/samples/redis/redis_string/redis_string.cpp:216–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216static bool test_mget(acl::redis_string& redis, int n)
217{
218 acl::string key1, key2, key3;
219 std::vector<acl::string> result;
220 const char* keys[3];
221
222 for (int i = 0; i < n; i++)
223 {
224 key1.format("key1_%s_%d", __keypre.c_str(), i);
225 key2.format("key2_%s_%d", __keypre.c_str(), i);
226 key3.format("key3_%s_%d", __keypre.c_str(), i);
227 keys[0] = key1.c_str();
228 keys[1] = key2.c_str();
229 keys[2] = key3.c_str();
230
231 result.clear();
232 redis.clear();
233 if (redis.mget(keys, 3, &result) == false)
234 {
235 printf("mset error: %s\r\n", redis.result_error());
236 return false;
237 }
238 else if (i >= 10)
239 continue;
240
241 size_t size = redis.result_size();
242 printf("size: %lu\r\n", (unsigned long) size);
243
244 size_t j;
245 for (j = 0; j < size; j++)
246 {
247 const char* val = redis.result_value(j);
248 printf("mget ok, %s=%s\r\n",
249 keys[j], val ? val : "null");
250 }
251
252 std::vector<acl::string>::const_iterator it= result.begin();
253 for (j = 0; it != result.end(); ++it, j++)
254 printf("mget %s=%s\r\n", keys[j], (*it).c_str());
255 }
256
257 return true;
258}
259
260static bool test_msetnx(acl::redis_string& redis, int n)
261{

Callers 1

mainFunction · 0.85

Calls 9

mgetMethod · 0.80
result_errorMethod · 0.80
result_sizeMethod · 0.80
result_valueMethod · 0.80
beginMethod · 0.80
formatMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…