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

Method HandleCacheOpenRead

src/proxy/http/HttpTransact.cc:2376–2422  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// Name : HandleCacheOpenRead Description: the cache lookup succeeded - may have been a hit or a miss Details : the cache lookup succeeded. first check if the lookup resulted in a hit or a miss, if the lookup was for an http request. This function just funnels the result into the appropriate functions which handle t

Source from the content-addressed store, hash-verified

2374//
2375///////////////////////////////////////////////////////////////////////////////
2376void
2377HttpTransact::HandleCacheOpenRead(State *s)
2378{
2379 TxnDbg(dbg_ctl_http_trans, "[HttpTransact::HandleCacheOpenRead]");
2380
2381 SET_VIA_STRING(VIA_DETAIL_CACHE_TYPE, VIA_DETAIL_CACHE);
2382
2383 bool read_successful = true;
2384
2385 if (s->cache_info.object_read == nullptr) {
2386 read_successful = false;
2387 //
2388 // If somebody else was writing the document, proceed just like it was
2389 // a normal cache miss, except don't try to write to the cache
2390 //
2391 if (s->cache_lookup_result == CACHE_LOOKUP_DOC_BUSY) {
2392 s->cache_lookup_result = CACHE_LOOKUP_MISS;
2393 s->cache_info.action = CACHE_DO_NO_ACTION;
2394 }
2395 } else {
2396 CacheHTTPInfo *obj = s->cache_info.object_read;
2397 if (obj->response_get()->type_get() == HTTP_TYPE_UNKNOWN) {
2398 read_successful = false;
2399 }
2400 if (obj->request_get()->type_get() == HTTP_TYPE_UNKNOWN) {
2401 read_successful = false;
2402 }
2403 }
2404
2405 if (s->method == HTTP_WKSIDX_PUSH) {
2406 HandleCacheOpenReadPush(s, read_successful);
2407 } else if (read_successful == false) {
2408 // cache miss
2409 TxnDbg(dbg_ctl_http_trans, "CacheOpenRead -- miss");
2410 SET_VIA_STRING(VIA_DETAIL_CACHE_LOOKUP, VIA_DETAIL_MISS_NOT_CACHED);
2411 // Perform DNS for the origin when it is required.
2412 // 1. If parent configuration does not allow to go to origin there is no need of performing DNS
2413 // 2. If parent satisfies the request there is no need to go to origin to perform DNS
2414 HandleCacheOpenReadMiss(s);
2415 } else {
2416 // cache hit
2417 TxnDbg(dbg_ctl_http_trans, "CacheOpenRead -- hit");
2418 TRANSACT_RETURN(SM_ACTION_API_READ_CACHE_HDR, HandleCacheOpenReadHitFreshness);
2419 }
2420
2421 return;
2422}
2423
2424///////////////////////////////////////////////////////////////////////////////
2425// Name : issue_revalidate

Callers

nothing calls this directly

Calls 3

type_getMethod · 0.80
response_getMethod · 0.80
request_getMethod · 0.80

Tested by

no test coverage detected