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

Function test_set

lib_acl_cpp/samples/redis/redis_string/redis_string.cpp:6–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4static acl::string __keypre("test_key");
5
6static bool test_set(acl::redis_string& redis, int n)
7{
8 acl::string key;
9 acl::string value;
10
11 for (int i = 0; i < n; i++)
12 {
13 key.format("%s_%d", __keypre.c_str(), i);
14 value.format("value_%s", key.c_str());
15
16 redis.clear();
17 redis.set_check_addr(__check_addr);
18 if (redis.set(key.c_str(), value.c_str(), 100, SETFLAG_EX | SETFLAG_NX) == false)
19 {
20 printf("set key: %s error: %s\r\n",
21 key.c_str(), redis.result_error());
22 return false;
23 }
24 else if (i < 10)
25 printf("set key: %s ok\r\n", key.c_str());
26 }
27
28 return true;
29}
30
31static bool test_setex(acl::redis_string& redis, int n, int ttl)
32{

Callers 1

mainFunction · 0.70

Calls 6

result_errorMethod · 0.80
formatMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45
set_check_addrMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…