MCPcopy Create free account
hub / github.com/apache/trafficserver / removeCacheKey

Function removeCacheKey

plugins/esi/esi.cc:531–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

529}
530
531static bool
532removeCacheKey(TSHttpTxn txnp)
533{
534 TSMBuffer req_bufp;
535 TSMLoc req_hdr_loc;
536 TSMLoc url_loc = nullptr;
537 TSCont contp = nullptr;
538 TSCacheKey cacheKey = nullptr;
539 bool result = false;
540
541 if (TSHttpTxnClientReqGet(txnp, &req_bufp, &req_hdr_loc) != TS_SUCCESS) {
542 TSError("[esi][%s] Error while retrieving client request", __FUNCTION__);
543 return false;
544 }
545
546 do {
547 if (TSHttpTxnPristineUrlGet(txnp, &req_bufp, &url_loc) != TS_SUCCESS) {
548 TSError("[esi][%s] Error while retrieving hdr url", __FUNCTION__);
549 break;
550 }
551
552 contp = TSContCreate(removeCacheHandler, nullptr);
553 if (contp == nullptr) {
554 TSError("[esi][%s] Could not create continuation", __FUNCTION__);
555 break;
556 }
557
558 cacheKey = TSCacheKeyCreate();
559 if (cacheKey == nullptr) {
560 TSError("[esi][%s] TSCacheKeyCreate fail", __FUNCTION__);
561 break;
562 }
563
564 if (TSCacheKeyDigestFromUrlSet(cacheKey, url_loc) != TS_SUCCESS) {
565 TSError("[esi][%s] TSCacheKeyDigestFromUrlSet fail", __FUNCTION__);
566 break;
567 }
568
569 TSCacheRemove(contp, cacheKey);
570 result = true;
571 TSError("[esi][%s] TSCacheRemoved", __FUNCTION__);
572 } while (false);
573
574 if (cacheKey != nullptr) {
575 TSCacheKeyDestroy(cacheKey);
576 }
577 if (!result) {
578 if (contp != nullptr) {
579 TSContDestroy(contp);
580 }
581 }
582
583 TSHandleMLocRelease(req_bufp, req_hdr_loc, url_loc);
584 if (req_hdr_loc != nullptr) {
585 TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_hdr_loc);
586 }
587
588 return result;

Callers 2

transformDataFunction · 0.85
addTransformFunction · 0.85

Calls 10

TSHttpTxnClientReqGetFunction · 0.85
TSHttpTxnPristineUrlGetFunction · 0.85
TSContCreateFunction · 0.85
TSCacheKeyCreateFunction · 0.85
TSCacheRemoveFunction · 0.85
TSCacheKeyDestroyFunction · 0.85
TSContDestroyFunction · 0.85
TSHandleMLocReleaseFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected