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

Method bpop

lib_acl_cpp/src/redis/redis_list.cpp:372–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372bool redis_list::bpop(const char* cmd, const std::vector<const char*>& keys,
373 size_t timeout, std::pair<string, string>& result)
374{
375 size_t argc = 2 + keys.size();
376 const char** args = (const char**) dbuf_->dbuf_alloc(argc * sizeof(char*));
377 size_t* lens = (size_t*) dbuf_->dbuf_alloc(argc * sizeof(size_t));
378
379 args[0] = cmd;
380 lens[0] = strlen(cmd);
381
382 size_t i = 1;
383 std::vector<const char*>::const_iterator cit = keys.begin();
384 for (; cit != keys.end(); ++cit) {
385 args[i] = *cit;
386 lens[i] = strlen(args[i]);
387 i++;
388 }
389
390 char* buf = (char*) dbuf_->dbuf_alloc(LONG_LEN);
391 safe_snprintf(buf, LONG_LEN, "%lu", (unsigned long) timeout);
392 args[i] = buf;
393 lens[i] = strlen(args[i]);
394
395 build_request(argc, args, lens);
396 return bpop(result);
397}
398
399bool redis_list::bpop(const char* cmd, const std::vector<string>& keys,
400 size_t timeout, std::pair<string, string>& result)

Callers

nothing calls this directly

Calls 13

safe_snprintfFunction · 0.85
dbuf_allocMethod · 0.80
beginMethod · 0.80
build_requestFunction · 0.50
runFunction · 0.50
sizeMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
get_typeMethod · 0.45
get_sizeMethod · 0.45
get_childMethod · 0.45

Tested by

no test coverage detected