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

Method del

lib_acl_cpp/src/memcache/memcache.cpp:451–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449}
450
451bool memcache::del(const char* key, size_t klen)
452{
453 bool has_tried = false;
454 const string& kbuf = build_key(key, klen);
455
456AGAIN:
457 if (!open()) {
458 return false;
459 }
460
461 req_line_.format("delete %s\r\n", kbuf.c_str());
462 if (conn_->write(req_line_) < 0) {
463 if (retry_ && !has_tried) {
464 has_tried = true;
465 goto AGAIN;
466 }
467 ebuf_.format("write (%s) error", req_line_.c_str());
468 return false;
469 }
470 // DELETED|NOT_FOUND\r\n
471 if (!conn_->gets(res_line_)) {
472 if (retry_ && !has_tried) {
473 has_tried = true;
474 goto AGAIN;
475 }
476 ebuf_.format("reply for(%s) error", req_line_.c_str());
477 return false;
478 }
479 if (res_line_.compare("DELETED", false) != 0
480 && res_line_.compare("NOT_FOUND", false) != 0) {
481
482 ebuf_.format("reply(%s) for (%s) error",
483 res_line_.c_str(), req_line_.c_str());
484 return false;
485 }
486 return true;
487}
488
489bool memcache::del(const char* key)
490{

Callers

nothing calls this directly

Calls 7

openFunction · 0.85
delFunction · 0.85
getsMethod · 0.80
compareMethod · 0.80
formatMethod · 0.45
c_strMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected