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

Function test_hset

lib_acl_cpp/samples/redis/redis_hash/redis_hash.cpp:92–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92static bool test_hset(acl::redis_hash& redis, int n)
93{
94 acl::string key;
95 acl::string attr, value;
96
97 for (int i = 0; i < n; i++)
98 {
99 key.format("%s_%d", __keypre.c_str(), i);
100 attr.format("attr1");
101 value.format("value_%s", key.c_str());
102
103 redis.clear();
104 if (redis.hset(key.c_str(), attr.c_str(),
105 value.c_str()) < 0)
106 {
107 printf("hset key: %s error: %s\r\n",
108 key.c_str(), redis.result_error());
109 return false;
110 }
111 else if (i < 10)
112 printf("hset key: %s ok\r\n", key.c_str());
113 }
114
115 return true;
116}
117
118static bool test_hsetnx(acl::redis_hash& redis, int n)
119{

Callers 1

mainFunction · 0.85

Calls 5

hsetMethod · 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…