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

Function respToTriggerPrefetch

plugins/prefetch/plugin.cc:468–484  ·  view source on GitHub ↗

* @brief Find out if the current response to trigger a background prefetch. * * Pre-fetch only on HTTP codes 200 and 206 or object found in cache (previous good response) * * @param txnp HTTP transaction structure * @return true - trigger prefetch, false - don't trigger. */

Source from the content-addressed store, hash-verified

466 * @return true - trigger prefetch, false - don't trigger.
467 */
468static bool
469respToTriggerPrefetch(TSHttpTxn txnp)
470{
471 bool trigger = false;
472 if (foundFresh(txnp)) {
473 /* If found in cache and fresh trigger next (same as good response from origin) */
474 PrefetchDebug("trigger background fetch (cached)");
475 trigger = true;
476 } else if (isResponseGood(txnp)) {
477 /* Trigger all necessary background fetches based on the next path pattern */
478 PrefetchDebug("trigger background fetch (good origin response)");
479 trigger = true;
480 } else {
481 PrefetchDebug("don't trigger background fetch");
482 }
483 return trigger;
484}
485
486/**
487 * @brief Callback function that handles necessary foreground / background fetch operations.

Callers 1

contHandleFetchFunction · 0.85

Calls 2

foundFreshFunction · 0.85
isResponseGoodFunction · 0.85

Tested by

no test coverage detected