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

Function test_setex

lib_acl_cpp/samples/redis/redis_string/redis_string.cpp:31–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31static bool test_setex(acl::redis_string& redis, int n, int ttl)
32{
33 acl::string key, value;
34
35 for (int i = 0; i < n; i++)
36 {
37 key.format("%s_%d", __keypre.c_str(), i);
38 value.format("value_%s", key.c_str());
39
40 redis.clear();
41 if (redis.setex(key.c_str(), value.c_str(), ttl) == false)
42 {
43 printf("setex key: %s error: %s\r\n",
44 key.c_str(), redis.result_error());
45 return false;
46 }
47 else if (i < 10)
48 printf("setex key: %s, ttl: %d\r\n", key.c_str(), ttl);
49 }
50
51 return true;
52}
53
54static bool test_setnx(acl::redis_string& redis, int n)
55{

Callers 1

mainFunction · 0.85

Calls 5

setexMethod · 0.80
result_errorMethod · 0.80
formatMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…