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

Function test_mset

lib_acl_cpp/samples/redis/redis_string/redis_string.cpp:177–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177static bool test_mset(acl::redis_string& redis, int n)
178{
179 acl::string key1, key2, key3;
180 acl::string val1, val2, val3;
181 std::map<acl::string, acl::string> objs;
182
183 for (int i = 0; i < n; i++)
184 {
185 key1.format("key1_%s_%d", __keypre.c_str(), i);
186 key2.format("key2_%s_%d", __keypre.c_str(), i);
187 key3.format("key3_%s_%d", __keypre.c_str(), i);
188
189 val1.format("val1_%s", key1.c_str());
190 val2.format("val2_%s", key2.c_str());
191 val3.format("val3_%s", key3.c_str());
192
193 objs[key1] = val1;
194 objs[key2] = val2;
195 objs[key3] = val3;
196
197 redis.clear();
198 if (redis.mset(objs) == false)
199 {
200 printf("mset error: %s\r\n", redis.result_error());
201 return false;
202 }
203 else if (i < 10)
204 {
205 printf("mset ok, %s=%s, %s=%s, %s=%s\r\n",
206 key1.c_str(), val1.c_str(),
207 key2.c_str(), val2.c_str(),
208 key3.c_str(), val3.c_str());
209 }
210 objs.clear();
211 }
212
213 return true;
214}
215
216static bool test_mget(acl::redis_string& redis, int n)
217{

Callers 1

mainFunction · 0.85

Calls 5

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